Iris supports plugins under the iris.plugins namespace package. This allows packages that extend Iris’ functionality to be developed and maintained independently, while still being installed into iris.plugins instead of a separate package. For example, a plugin may provide loaders or savers for additional file formats, or alternative visualisation methods.

Using plugins#

Once a plugin is installed, it can be used either via the iris.use_plugin() function, or by importing it directly:

import iris

# OR
import iris.plugins.my_plugin

Creating plugins#

The choice of a namespace package makes writing a plugin relatively straightforward: it simply needs to appear as a folder within iris/plugins, then can be distributed in the same way as any other package. An example repository layout:

+ lib
  + iris
    + plugins
      + my_plugin
        - (more code...)
- pyproject.toml
- setup.cfg
- (other project files...)

In particular, note that there must not be any files at higher levels than the plugin itself.

The package name - how it is referred to by PyPI/conda, specified by in setup.cfg - is recommended to include both “iris” and the plugin name. Continuing this example, its setup.cfg should include, at minimum:

name = iris-my-plugin

packages = find_namespace:

where = lib