ome / omero-cli-zarr

https://pypi.org/project/omero-cli-zarr/
GNU General Public License v2.0
15 stars 10 forks source link

Remove opencv dependency #80

Closed sbesson closed 3 years ago

sbesson commented 3 years ago

Previously, the CLI plugin relied on the opencv dependency transitively through ome-zarr-py. However, this dependency has been dropped as part of the 0.3 specification support in https://github.com/ome/ome-zarr-py/pull/89. With the release of ome-zarr-py==0.0.24, @dominikl has established the standard installation of omero-cli-zarr is currently broken (without a manual installation of the dependency):

(zarr) ➜  Downloads omero zarr --help
Error loading: /Users/dom/miniconda3/envs/zarr/lib/python3.9/site-packages/omero/plugins/zarr.py
Traceback (most recent call last):
  File "/Users/dom/miniconda3/envs/zarr/lib/python3.9/site-packages/omero/cli.py", line 1690, in loadpath
    execfile(str(pathobj), loc)
  File "/Users/dom/miniconda3/envs/zarr/lib/python3.9/site-packages/past/builtins/misc.py", line 87, in execfile
    exec_(code, myglobals, mylocals)
  File "/Users/dom/miniconda3/envs/zarr/lib/python3.9/site-packages/omero/plugins/zarr.py", line 1, in <module>
    from omero_zarr.cli import HELP, ZarrControl
  File "/Users/dom/miniconda3/envs/zarr/lib/python3.9/site-packages/omero_zarr/cli.py", line 13, in <module>
    from .raw_pixels import image_to_zarr, plate_to_zarr
  File "/Users/dom/miniconda3/envs/zarr/lib/python3.9/site-packages/omero_zarr/raw_pixels.py", line 6, in <module>
    import cv2
ModuleNotFoundError: No module named 'cv2'
usage: /Users/dom/miniconda3/envs/zarr/bin/omero [-h] [-v] [-d DEBUG]
                                                 [--path PATH] [-C]
                                                 [-s SERVER] [-p PORT]
                                                 [-g GROUP] [-u USER]
                                                 [-w PASSWORD] [-k KEY]
                                                 [--sudo ADMINUSER] [-q]
                                                 <subcommand> ...
/Users/dom/miniconda3/envs/zarr/bin/omero: error: argument <subcommand>: invalid choice: 'zarr'

choose from:
    admin, chgrp, chown, config, db, delete, download, errors, export,
    fs, group, help, hql, import, ldap, load, login, logout, node,
    obj, perf, quit, script, search, sessions, shell, tag, testengine,
    upload, user, version

This PR proposes to fix this installation issue and align the downsampling implementation to use the same library as ome-zarr-py.

A follow-up refactoring would probably be to delegate the downsampling logic to a relevant ome-zarr-py API. @will-moore

dominikl commented 3 years ago

Looks good for me, could install and use the plugin from this PR without any additional libraries installed previously 👍

sbesson commented 3 years ago

Unless there is a strong objection, once this is reviewed and accepted, I'd like to use this occasion to release ome-zarr-py AND omero-cli-zarr as 0.1.0.

This dependency removal is a classical example where, from a consumer perspective, changes like https://github.com/ome/ome-zarr-py/pull/89 should be communicated via a 0.x.0 version increment. Consumers can then review the implications in terms of breaking behavior and the impact on their code. /cc @constantinpape

joshmoore commented 3 years ago

0.1.0 works for me.

constantinpape commented 3 years ago

Sounds good!

sbesson commented 3 years ago

Thanks. Just waiting for the review of @will-moore and I will action the release

will-moore commented 3 years ago

Looks good, thanks! Tested locally on landscape image and all resolutions are also landscape. Good to merge.