Skip to content

Commit

Permalink
Merge pull request #33 from manics/versioning
Browse files Browse the repository at this point in the history
setuptools_scm, include version in omero metadata
  • Loading branch information
sbesson authored Oct 28, 2020
2 parents d63e099 + 3c75b83 commit ddbcba9
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ venv/
build/
dist/
__pycache__
src/omero_zarr/_version.py
2 changes: 2 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,6 @@
install_requires=["omero-py>=5.6.0", "ome-zarr"],
keywords=["OMERO.CLI", "plugin"],
url="https://github.com/ome/omero-cli-zarr/",
setup_requires=["setuptools_scm"],
use_scm_version={"write_to": "src/omero_zarr/_version.py"},
)
5 changes: 5 additions & 0 deletions src/omero_zarr/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from ._version import version as __version__

__all__ = [
"__version__",
]
9 changes: 9 additions & 0 deletions src/omero_zarr/raw_pixels.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
from omero.rtypes import unwrap
from zarr.hierarchy import Group, open_group

from . import __version__


def image_to_zarr(image: omero.gateway.ImageWrapper, args: argparse.Namespace) -> None:
target_dir = args.output
Expand All @@ -20,6 +22,7 @@ def image_to_zarr(image: omero.gateway.ImageWrapper, args: argparse.Namespace) -
root = open_group(name, mode="w")
n_levels = add_image(image, root, cache_dir=cache_dir)
add_group_metadata(root, image, n_levels)
add_toplevel_metadata(root)
print("Finished.")


Expand Down Expand Up @@ -178,6 +181,7 @@ def plate_to_zarr(plate: omero.gateway._PlateWrapper, args: argparse.Namespace)
plate_metadata["images"] = [{"path": x} for x in paths]
root.attrs["plate"] = plate_metadata

add_toplevel_metadata(root)
print("Finished.")


Expand Down Expand Up @@ -219,6 +223,11 @@ def add_group_metadata(
image._closeRE()


def add_toplevel_metadata(zarr_root: Group) -> None:

zarr_root.attrs["_creator"] = {"name": "omero-zarr", "version": __version__}


def channelMarshal(channel: omero.model.Channel) -> Dict[str, Any]:
return {
"label": channel.getLabel(),
Expand Down

0 comments on commit ddbcba9

Please sign in to comment.