betty.plugin.entry_point module - Betty documentation

Hide navigation sidebar
Hide table of contents sidebar
Skip to content
Back to top
View this page
Toggle table of contents sidebar

# betty.plugin.entry_point module

Integrates the plugin API with distribution packages.

final class betty.plugin.entry_point.EntryPointPluginRepository

  Bases: `LazyPluginRepositoryBase`[`_PluginT`], `Generic`[`_PluginT`]

  Discover plugins defined as distribution package entry points.

  If you are developing a plugin for an existing plugin type that uses entry points, you’ll have to add that plugin to your package metadata. For example, for a plugin type

  - whose entry point group is `your-plugin-group`

  - with a plugin class `MyPlugin` in the module `my_package.my_module`

  - and a plugin ID `my-package-plugin`:

  pyproject.toml

      [project.entry-points.'your-plugin-group']
      'my-package-plugin' = 'my_package.my_module:MyPlugin'

  setup.py

      SETUP = {
          'entry_points': {
              'your-plugin-group': [
                  'my-package-plugin=my_package.my_module:MyPlugin',
              ],
          },
      }
      if __name__ == '__main__':
          setup(**SETUP)

  __init__(entry_point_group: str, *, schema_template: Schema | None = None)