betty.project.extension package - Betty 0.4.0a4 documentation

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

# betty.project.extension package

## Submodules

- betty.project.extension.requirement module
  - `Dependencies`
    - `Dependencies.__init__()`
    - `Dependencies.summary()`
  - `Dependents`
    - `Dependents.__init__()`
    - `Dependents.is_met()`
    - `Dependents.summary()`

## Module contents

Provide Betty’s extension API.

class betty.project.extension.ConfigurableExtension

  Bases: `Extension`, `Generic`[`_ConfigurationT`], `Configurable`[`_ConfigurationT`]

  A configurable extension.

  __init__(project: Project)
  abstract classmethod default_configuration() → _ConfigurationT

    Get this extension’s default configuration.

exception betty.project.extension.CyclicDependencyError

  Bases: `ExtensionError`, `RuntimeError`

  Raised when extensions define a cyclic dependency, e.g. two extensions depend on each other.

  __init__(extension_types: Iterable[type[Extension]])

betty.project.extension.EXTENSION_REPOSITORY: PluginRepository[Extension] = <betty.plugin.entry_point.EntryPointPluginRepository object>

  The project extension plugin repository.

class betty.project.extension.Extension

  Bases: `Plugin`, `CoreComponent`, `ProjectDependentFactory`

  Integrate optional functionality with Betty :py:class:`betty.project.Project`s.

  __init__(project: Project)
  classmethod assets_directory_path() → Path | None

    Return the path on disk where the extension’s assets are located.

    This may be anywhere in your Python package.

  classmethod comes_after() → set[str]

    The extensions that this one comes after.

    The other extensions may or may not be enabled.

  classmethod comes_before() → set[str]

    The extensions that this one comes before.

    The other extensions may or may not be enabled.

  classmethod depends_on() → set[str]

    The extensions this one depends on, and comes after.

  disable_requirement() → Requirement

    Define the requirement for this extension to be disabled.

    This defaults to the extension’s dependents.

  classmethod enable_requirement() → Requirement

    Define the requirement for this extension to be enabled.

    This defaults to the extension’s dependencies.

  classmethod new_for_project(project: Project) → Self

    Create a new instance.

  property project: Project

    The project this extension runs within.

  register_event_handlers(registry: EventHandlerRegistry) → None

    Register event handlers with the project.

exception betty.project.extension.ExtensionError

  Bases: `BaseException`

  A generic extension API error.

class betty.project.extension.Theme

  Bases: `Extension`

  An extension that is a front-end theme.

async betty.project.extension.build_extension_type_graph(extension_types: Iterable[type[Extension]]) → dict[type[Extension], set[type[Extension]]]

  Build a dependency graph of the given extension types.