New Command

Warning

This command in in development and not all the plugins types are implemented yet.

The new command is used to create a new plugin project.

% anemoi-plugins new PLUGIN_TYPE --name PLUGIN_NAME

Plugin types are:

  • datasets.create.filter

  • datasets.create.source

  • inference.input

  • inference.output

  • inference.post-processor

  • inference.pre-processor

  • inference.runner

  • transform.filter

  • transform.source

The command will create a new Python package with the necessary structure to create a plugin. The command will also create a pyproject.toml file with the necessary entrypoints, a README file and a test file.

─── PROJECT-NAME
    ├── README.md
    ├── pyproject.toml
    ├── tests
    │   └── test_plugin.py
    └── PACKAGE-NAME
        └── PLUGIN-NAME.py

Where PROJECT-NAME is the name of the project, PACKAGE-NAME is the name of the package and PLUGIN-NAME is the name of the plugin. PROJECT-NAME and PACKAGE-NAME are the same by default, the first one uses hiphen-case and the second one uses snake_case.

By default, the plugin class will inherit from the corresponding class of the plugin type. In some cases, there already exists some spetialised subclasses that can be used instead. For example, the anemoi.datasets.create.source can be spetialised to support Xarray-based sources. You can select the specialisation with the --specialisation xarray option.

Command description

Create a new plugin.

usage: anemoi-plugins new [-h] [--name NAME] [--package PACKAGE]
                          [--specialisation {matching}]
                          [--path PATH | --doc | --examples]
                          PLUGIN

Positional Arguments

PLUGIN

Possible choices: datasets.create.filter, datasets.create.source, inference.input, inference.output, inference.post_processing, inference.pre_processing, inference.runner, transform.filter, transform.source

The type of plugin

Named Arguments

--name

The name of the plugin

Default: 'example'

--package

The package of the plugin

--specialisation

Possible choices: matching

Specialise plugin

--path

Output directory

Default: '.'

--doc

Generate doc examples

Default: False

--examples

Generate examples

Default: False