betty.plugin.config 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.config module

Provide plugin configuration.

class betty.plugin.config.PluginConfiguration

  Bases: `Configuration`

  Configure a single plugin.

  __init__(plugin_id: MachineName, label: ShorthandStaticTranslations, *, description: ShorthandStaticTranslations | None = None)
  description

    An instance attribute that contains `betty.locale.localizable.config.StaticTranslationsLocalizableConfiguration`.

  dump() → DumpMapping[Dump]

    Produce a serialized data dump of `self`.

  property id: str

    The configured plugin ID.

  label

    An instance attribute that contains `betty.locale.localizable.config.StaticTranslationsLocalizableConfiguration`.

  load(dump: Dump) → None

    Load a serialized data dump into `self`.

    Raises:

      betty.assertion.error.AssertionFailed – Raised if the dump is invalid.

class betty.plugin.config.PluginConfigurationMapping

  Bases: `ConfigurationMapping`[`str`, `_PluginConfigurationT`], `Generic`[`_PluginCoT`, `_PluginConfigurationT`]

  Configure a collection of plugins.

  new_plugins() → Sequence[type[_PluginCoT]]

    Create the plugins for this configuration.

    You SHOULD NOT cache the value anywhere, as it will change when this configuration changes.

class betty.plugin.config.PluginConfigurationPluginConfigurationMapping

  Bases: `PluginConfigurationMapping`[`_PluginCoT`, `PluginConfiguration`], `Generic`[`_PluginCoT`]

  Configure a collection of plugins using `betty.plugin.config.PluginConfiguration`.

class betty.plugin.config.PluginIdentifierKeyConfigurationMapping

  Bases: `ConfigurationMapping`[`str`, `_ConfigurationT`], `Generic`[`_PluginT`, `_ConfigurationT`]

  A mapping of configuration, keyed by a plugin identifier.

class betty.plugin.config.PluginInstanceConfiguration

  Bases: `Configuration`

  Configure a single plugin instance.

  Plugins that extend `betty.config.DefaultConfigurable` may receive their configuration from `betty.plugin.config.PluginInstanceConfiguration.configuration` / the “configuration” dump key.

  __init__(plugin_id: type[Plugin] | MachineName, *, configuration: Voidable[Configuration | Dump] = <class 'betty.typing.Void'>)
  property configuration: Voidable[Dump]

    Get the plugin’s own configuration.

  dump() → Dump

    Produce a serialized data dump of `self`.

  property id: str

    The plugin ID.

  load(dump: Dump) → None

    Load a serialized data dump into `self`.

    Raises:

      betty.assertion.error.AssertionFailed – Raised if the dump is invalid.

  async new_plugin_instance(repository: PluginRepository[_PluginT]) → _PluginT

    Create a new plugin instance.

class betty.plugin.config.PluginInstanceConfigurationMapping

  Bases: `PluginIdentifierKeyConfigurationMapping`[`_PluginT`, `PluginInstanceConfiguration`], `Generic`[`_PluginT`]

  Configure plugin instances, keyed by their plugin IDs.

  __init__(configurations: Iterable[PluginInstanceConfiguration] | None = None)