.. _development-plugins: Plugins ======= This section describes how plugins can be developed as stand-alone packages in order to extend the functionality of |kadi| without having to touch the main application code. As currently all first-party plugins are part of the main application package, all existing examples can be found in the :mod:`kadi.plugins` module. This also includes code not implemented as a separate plugin, but still using the plugin infrastructure. Plugin infrastructure --------------------- The plugin infrastructure in |kadi| builds upon `pluggy `__, a simple and flexible plugin system. It allows implementing different plugin interface functions, called hook specifications, which a plugin can choose to implement. Each hook will be called in certain places in the application, which will invoke all corresponding implementations of that hook. In order for the main application to find a plugin, the plugin has to register itself using the ``kadi_plugins`` entry point, as also done for all first-party plugins in the ``pyproject.toml`` file. Each plugin needs to specify a unique name and the module that contains all hook implementations, according to the plugin's corresponding build system configuration: .. tab:: pyproject.toml .. code-block:: toml [project] dependencies = [ "kadi>=X,=X,=X,`). An example implementation could look like the following: .. code-block:: python3 from kadi.lib.plugins.core import get_plugin_config from kadi.plugins import hookimpl @hookimpl def kadi_example_plugin_hook(): # Load the configuration of the "example" plugin, if applicable. config = get_plugin_config("example") # Validate the configuration or do something else with it. To see a list of all currently existing hook specifications, please refer to the :ref:`API reference `.