will-moore / omero-annotation_scripts

testing a pip-installable way to install OMERO scripts
GNU General Public License v2.0
0 stars 0 forks source link

Example of how to manage OMERO scripts install for users #1

Open will-moore opened 7 months ago

will-moore commented 7 months ago

Hi @Tom-TBT, cc @joshmoore @jburel

This repo is based on the same idea I had for omero-figure at https://github.com/ome/omero-figure/pull/366/files which is to add an omero cli plugin command for uploading scripts.

For this repo, you can do

$ pip install -e .
$ omero annotation_scripts upload

This will upload all the scripts in https://github.com/will-moore/omero-annotation_scripts/tree/main/src/scripts to OMERO with a path of /omero/annotation_scripts/, and if they are already there then they will be updated.

This cli plugin was created with https://github.com/ome/cookiecutter-omero-cli-plugin and still has lots of bits not filled out yet.

This is just a proof-of-concept, as an example of a possible way for users to install your scripts.

joshmoore commented 7 months ago

No objections to the above, but before anyone spends too much time on it, I think it would be possible to have: pip install omero-scripts-X and no longer need to modify lib/scripts.

will-moore commented 7 months ago

@joshmoore Can you explain a bit more what you're thinking here? "no longer need to modify lib/scripts" You mean that the scripting service will use scripts from a different location?

Tom-TBT commented 7 months ago

@joshmoore Are you talking of something like that? https://stackoverflow.com/a/19404371/10712860

joshmoore commented 7 months ago

No, more like: https://github.com/zarr-developers/numcodecs/pull/300

or:

https://github.com/German-BioImaging/omero-rdf/blob/main/src/omero_rdf/__init__.py#L97C1-L101C50

    for ep in entrypoints.get_group_all("omero_rdf.annotation_handler"):
        ah_loader = ep.load()
        self.annotation_handlers.append(ah_loader(self))
    # We know there are some built in handlers
    assert len(self.annotation_handlers) >= 1

but entrypoints.get_group_all("omero_scripts.script_provider")

joshmoore commented 7 months ago

@joshmoore Can you explain a bit more what you're thinking here? "no longer need to modify lib/scripts" You mean that the scripting service will use scripts from a different location?

Yeah, the processor.py would make use of entrypoints to load the strings of the scripts. In an initial prototype, that might mean that the strings get written to lib/scripts though that's likely to have permission issues in various scenarios (like Docker). So the server will need to be updated to use the discovered scripts from processor. To support situations where someone has updated their scripts locally, the contents of lib/scripts should take priority, but this would be the beginning of deprecating them.