Skip to content

Plugins that are usable by both ImJoy and Napari #140

@sofroniewn

Description

@sofroniewn

Description

Based on some initial discussions between @royerloic and @oeway the idea was floated that Napari and ImJoy could try and share a plugin ecosystem. Both projects aim to make python based image analysis, including packages using deep learning and gpus, more accessible to the masses.

ImJoy is leveraging modern web technology and can be used in a browser whereas Napari is a python package that can be used as a standalone desktop app or with jupyter notebooks. Allowing for shared plugins that could easily be used by both tools could have massive benefits for the user and developer communities.

Here are some comments from @oeway the main ImJoy developer in the napari slack that could be used to get this discussion going:

@royerloic @sofroniewn I like the idea of having a common python plugin infrastucture, here is the current design of ImJoy plugin system:
Here is some ideas behind the plugin system of ImJoy:

  1. every plugin is a single file with .imjoy.html extension (e.g. link), the annotation declarative scheme we used is a json config block in the plugin file (e.g. link). We use a relatively consistent format across plugins in different languages (Javascript, Python, potentially more, WIP: ImageJ scripts ).
  2. complementary code/modules are provided through requirements (link). Tags (inspired by docker) can be used to specify different requirements for different branch of the same plugin (e.g. link), the user will need to choose which tag to be used during installation (e.g. link).
  3. plugin files can be hosted anywhere which can be accessed through https url including Github/Gist/Gitlab, Dropbox or Google drive, and can be with https://imjoy.io/#/app?plugin=PLUGIN_URL.
  4. The recommended way of deploying ImJoy plugins is through Github repo, any Github Repo can be transformed into a ImJoy plugin repo by adding a file called manifest.imjoy.json. ImJoy will render the list of plugins from a repo through https://imjoy.io/#/app?repo=GITHUB_USER/REPO_NAME (e.g. link and link). Another benifit of making a ImJoy repo is, you can then use shorter plugin URI format to refer to the plugin, e.g.: you can use: https://imjoy.io/#/app?plugin=oeway/Anet-Lite:Anet-Lite instead of https://imjoy.io/#/app?plugin=https://github.com/oeway/Anet-Lite/blob/master/anetLite.imjoy.html as described in “3”.
  5. The same plugin URI scheme described in “3" and “4” can be used to describe the dependency of a plugin (e.g. link).
  6. Each plugin can expose a set of api (at least setup and run) through api.export call (e.g. link), the same applies to different types of plugins. Any plugin can call exported api functions in another plugin, the call can be concurrent through async/await syntax in JS and Python
  7. You can describe the inputs/outputs of a plugin with JSON-schema (https://json-schema.org/), it will be helpful for validating the inputs/outputs of a plugin and also for building a computational graph in the future. (e.g. link)
  8. One thing we really like to push forward is the concept of functional plugins — computational plugins consist of only pure functions with no side-effect (https://www.sitepoint.com/functional-programming-pure-functions/). The advantage of functional plugins is enhanced reproducibility and it allows us to better parallelize the plugin execution in the future. Example of a functional plugin: link. Ideally we would like most of the computational plugins be functional. For the moment, we don’t have a way to validate whether the plugin is functional, it’s upto the developer to add functional to flags (e.g: link), we planed to show a functional badge for those plugin in the plugin list of ImJoy.

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requestedtopic:pluginsRelates to our plugin ecosystem

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions