Writing a plugin - GeospatialResearch/Digital-Twins GitHub Wiki

An EDDIE plugin is a Python package that adds a domain (flood modelling, sea ice, pollutant runoff, ...) to the EDDIE core. The core finds every installed plugin at start-up and loads what it contributes.

Packaging

  • Name the distribution eddie-<name> and the import package eddie_<name> (convention only: EDDIE finds plugins through the entry point below, not the name). Package names must be unique, so two plugins can be installed together.
  • The plugin is pip-installed next to EDDIE (pip install -e . in development). Never import through src.: import eddie. for the core and your own package for the plugin.
  • Declare the plugin in its pyproject.toml:
    [project.entry-points."eddie.plugins"]
    otakaro = "eddie_otakaro"
    The value is the plugin's top-level package, not a submodule and not module:attr. If two entry points use the same name for different packages, EDDIE refuses to start.

Deprecated: finding plugins by their eddie_ name prefix. Packages named eddie_* without an entry point are still found for one release, with a warning; after that only the entry point counts. The eddie_<name> naming convention itself stays.

What the core owns

  • The Flask app (eddie.app:app) and the Celery app (eddie.tasks:app). A plugin never creates its own.
  • The WPS endpoint at /wps. A plugin never defines a /wps route.

Optional contributions

These are the pieces a plugin can give the core. Optional means each plugin provides only the ones it needs: a plugin with no web endpoints has no blueprint, a plugin with no background jobs has no tasks. At start-up the core uses whatever a plugin provides and skips the rest.

You provide What it is What the core does with it Available
blueprint The plugin's own web endpoints (URLs), grouped in a Flask Blueprint. Adds them to the core web app, next to the core's own endpoints. Now
tasks The plugin's background jobs (long-running work such as a model run), written as Celery tasks. Loads them into the core worker, so the worker can run them. Now
processes WPS processes. Identifiers are namespaced <plugin>.<process> (e.g. otakaro.medusa) and double as the cache process_id. Will list them on the core's single /wps endpoint. Planned, #412
catalog() Returns the Terria catalogue group(s) the plugin contributes. Will add them to /terria-catalog.json. Planned, #413
⚠️ **GitHub.com Fallback** ⚠️