Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setuptools_scm, include version in omero metadata #33

Merged
merged 2 commits into from
Oct 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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