Making a plugin

This section describes how to make a plugin for the Expipe command line interface (CLI). For the complete example; see

In order to make a plugin for the comman line interface you first need to make a python package.

Begin by making a folder named my_plugin with a module, let’s call it containing:

from expipe.cliutils import IPlugin
import click

class MyPlugin(IPlugin):
    """Create the `expipe print-me-stuff` command."""
    def attach_to_cli(self, cli):
        @click.argument('stuff', type=click.STRING)
        def print_me_stuff(stuff):
            Print stuff

            COMMAND: stuff

            print(f'Expipe is printing: {stuff}')

The folder my_plugin must also contain a file containing:

from .my_module import MyPlugin

In the root directory you need a file with the following minimum content:

from setuptools import setup

from setuptools import setup, find_packages


After the plugin package is ready, all you need to do is to install it and add it to the Expipe environment:

>>> python develop
>>> expipe config global --add plugin my_plugin

Finally, you can run your new incredible plugin with expipe:

>>> expipe print-me-stuff "Hey! This is my first Expipe plugin!"
Expipe is printing: Hey! This is my first Expipe plugin!