Plugins¶
Plugins are the mechanism through which optional, drop-in functionality can be provided to Betty. They are used for a variety of purposes, such as extending the Betty application, or providing additional ancestry data types.
Plugins must extend betty.plugin.Plugin
:
from typing import override from betty.locale.localizable import _ from betty.plugin import Plugin class MyPlugin(Plugin): @override @classmethod def plugin_id(cls) -> PluginId: return "my-plugin" @override @classmethod def plugin_label(cls) -> Localizable: return _("My Plugin")
Plugin types¶
Plugin types are discovered and made available through betty.plugin.PluginRepository
implementations.
Other than that, there are no guidelines or limitations for what plugins can do, or be used for.
Working with an existing plugin type¶
The plugin type’s documentation tells you where to find the plugin repository, how to use the plugins, and how to create your own.
Built-in plugin types¶
The following plugin types are provided by Betty itself:
Creating a new plugin type¶
If you are developing an API that needs a new plugin type, and you want other developers to be
able to define them as entry points, you must create a plugin repository, and you should create an abstract
plugin class that extends betty.plugin.Plugin
.
Built-in plugin repository types¶
betty.plugin.entry_point.EntryPointPluginRepository
to discover plugins defined as package entry points.
betty.plugin.lazy.LazyPluginRepositoryBase
to easily build repositories that lazily load their plugins.
betty.plugin.proxy.ProxyPluginRepository
to discover plugins via one or more upstream plugin repositories.
betty.plugin.static.StaticPluginRepository
to discover statically defined plugins.