diff options
Diffstat (limited to 'doc/source/dev/plugin.rst')
-rw-r--r-- | doc/source/dev/plugin.rst | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/doc/source/dev/plugin.rst b/doc/source/dev/plugin.rst index 7a63ed8f..4614c761 100644 --- a/doc/source/dev/plugin.rst +++ b/doc/source/dev/plugin.rst @@ -1,13 +1,32 @@ Plugin API documentation ======================== +External plugins +---------------- + +It is possible to create external plugins easily using `setuptools' +entry_point +<https://setuptools.readthedocs.io/en/latest/setuptools.html#dynamic-discovery-of-services-and-plugins>`_ +feature. You can register your plugin against the ``poezio_plugins`` entry +group with the following snippet in your project ``setup.py``: + +.. code-block:: python + + setup( + .. + packages=['yourmodule'], + entry_points={'poezio_plugins': 'yourplugin = yourmodule'}, + .. + ) + +The plugin will then be available as ``yourplugin`` at runtime. + BasePlugin ---------- .. module:: poezio.plugin .. autoclass:: BasePlugin - :members: init, cleanup, api, core .. method:: init(self) @@ -29,6 +48,16 @@ BasePlugin The :py:class:`~PluginAPI` instance for this plugin. + .. attribute:: dependencies + + Dependencies on other plugins, as a set of strings. A reference + to each dependency will be added in ``refs``. + + .. attribute:: refs + + This attribute is not to be edited by the user. It will be + populated when the plugin is initialized with references on each + plugin specified in the ``dependencies`` attribute. Each plugin inheriting :py:class:`~BasePlugin` has an ``api`` member variable, which refers to a :py:class:`~PluginAPI` object. |