betty.project.extension package - 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.project.extension package

## Subpackages

- betty.project.extension.cotton_candy package
  - Submodules
    - betty.project.extension.cotton_candy.config module
      - `CottonCandyConfiguration`
        - `CottonCandyConfiguration.DEFAULT_LINK_ACTIVE_COLOR`
        - `CottonCandyConfiguration.DEFAULT_LINK_INACTIVE_COLOR`
        - `CottonCandyConfiguration.DEFAULT_PRIMARY_ACTIVE_COLOR`
        - `CottonCandyConfiguration.DEFAULT_PRIMARY_INACTIVE_COLOR`
        - `CottonCandyConfiguration.__init__()`
        - `CottonCandyConfiguration.dump()`
        - `CottonCandyConfiguration.featured_entities`
        - `CottonCandyConfiguration.link_active_color`
        - `CottonCandyConfiguration.link_inactive_color`
        - `CottonCandyConfiguration.load()`
        - `CottonCandyConfiguration.primary_active_color`
        - `CottonCandyConfiguration.primary_inactive_color`
  - Module contents
    - `CottonCandy`
      - `CottonCandy.__init__()`
      - `CottonCandy.__new__()`
      - `CottonCandy.assets_directory_path()`
      - `CottonCandy.bootstrap()`
      - `CottonCandy.comes_after()`
      - `CottonCandy.depends_on()`
      - `CottonCandy.filters`
      - `CottonCandy.new_default_configuration()`
      - `CottonCandy.new_for_project()`
      - `CottonCandy.public_css_paths`
      - `CottonCandy.register_event_handlers()`
      - `CottonCandy.webpack_entry_point_cache_keys()`
      - `CottonCandy.webpack_entry_point_directory_path()`
- betty.project.extension.demo package
  - Submodules
    - betty.project.extension.demo.copyright_notice module
      - `Streetmix`
        - `Streetmix.summary`
        - `Streetmix.text`
        - `Streetmix.url`
    - betty.project.extension.demo.project module
      - `create_project()`
      - `load_ancestry()`
    - betty.project.extension.demo.serve module
      - `DemoServer`
        - `DemoServer.__init__()`
        - `DemoServer.public_url`
        - `DemoServer.start()`
        - `DemoServer.stop()`
  - Module contents
    - `Demo`
      - `Demo.depends_on()`
      - `Demo.register_event_handlers()`
      - `Demo.secondary_navigation_links()`
    - `generate_with_cleanup()`
- betty.project.extension.deriver package
  - Module contents
    - `Deriver`
      - `Deriver.comes_before()`
      - `Deriver.register_event_handlers()`
- betty.project.extension.gramps package
  - Submodules
    - betty.project.extension.gramps.config module
      - `FamilyTreeConfiguration`
        - `FamilyTreeConfiguration.__init__()`
        - `FamilyTreeConfiguration.dump()`
        - `FamilyTreeConfiguration.event_types`
        - `FamilyTreeConfiguration.file_path`
        - `FamilyTreeConfiguration.genders`
        - `FamilyTreeConfiguration.load()`
        - `FamilyTreeConfiguration.place_types`
        - `FamilyTreeConfiguration.presence_roles`
      - `FamilyTreeConfigurationSequence`
      - `GrampsConfiguration`
        - `GrampsConfiguration.__init__()`
        - `GrampsConfiguration.dump()`
        - `GrampsConfiguration.family_trees`
        - `GrampsConfiguration.load()`
      - `PluginMapping`
        - `PluginMapping.__init__()`
        - `PluginMapping.dump()`
        - `PluginMapping.load()`
  - Module contents
    - `Gramps`
      - `Gramps.new_default_configuration()`
      - `Gramps.register_event_handlers()`
- betty.project.extension.http_api_doc package
  - Module contents
    - `HttpApiDoc`
      - `HttpApiDoc.assets_directory_path()`
      - `HttpApiDoc.depends_on()`
      - `HttpApiDoc.secondary_navigation_links()`
      - `HttpApiDoc.webpack_entry_point_cache_keys()`
      - `HttpApiDoc.webpack_entry_point_directory_path()`
- betty.project.extension.maps package
  - Module contents
    - `Maps`
      - `Maps.assets_directory_path()`
      - `Maps.depends_on()`
      - `Maps.webpack_entry_point_cache_keys()`
      - `Maps.webpack_entry_point_directory_path()`
- betty.project.extension.privatizer package
  - Module contents
    - `Privatizer`
      - `Privatizer.register_event_handlers()`
- betty.project.extension.raspberry_mint package
  - Submodules
    - betty.project.extension.raspberry_mint.config module
      - `RaspberryMintConfiguration`
        - `RaspberryMintConfiguration.DEFAULT_PRIMARY_COLOR`
        - `RaspberryMintConfiguration.DEFAULT_SECONDARY_COLOR`
        - `RaspberryMintConfiguration.DEFAULT_TERTIARY_COLOR`
        - `RaspberryMintConfiguration.__init__()`
        - `RaspberryMintConfiguration.dump()`
        - `RaspberryMintConfiguration.featured_entities`
        - `RaspberryMintConfiguration.load()`
        - `RaspberryMintConfiguration.primary_color`
        - `RaspberryMintConfiguration.secondary_color`
        - `RaspberryMintConfiguration.tertiary_color`
  - Module contents
    - `RaspberryMint`
      - `RaspberryMint.__init__()`
      - `RaspberryMint.assets_directory_path()`
      - `RaspberryMint.bootstrap()`
      - `RaspberryMint.comes_after()`
      - `RaspberryMint.depends_on()`
      - `RaspberryMint.filters`
      - `RaspberryMint.new_default_configuration()`
      - `RaspberryMint.new_for_project()`
      - `RaspberryMint.public_css_paths`
      - `RaspberryMint.register_event_handlers()`
      - `RaspberryMint.webpack_entry_point_cache_keys()`
      - `RaspberryMint.webpack_entry_point_directory_path()`
- betty.project.extension.trees package
  - Module contents
    - `Trees`
      - `Trees.assets_directory_path()`
      - `Trees.depends_on()`
      - `Trees.register_event_handlers()`
      - `Trees.webpack_entry_point_cache_keys()`
      - `Trees.webpack_entry_point_directory_path()`
- betty.project.extension.webpack package
  - Subpackages
    - betty.project.extension.webpack.jinja2 package
      - Submodules
        - betty.project.extension.webpack.jinja2.filter module
          - `filter_webpack_entry_point_js()`
      - Module contents
  - Submodules
    - betty.project.extension.webpack.build module
      - `Builder`
        - `Builder.__init__()`
        - `Builder.build()`
      - `EntryPointProvider`
        - `EntryPointProvider.webpack_entry_point_cache_keys()`
        - `EntryPointProvider.webpack_entry_point_directory_path()`
      - `webpack_build_id()`
  - Module contents
    - `PrebuiltAssetsRequirement`
      - `PrebuiltAssetsRequirement.is_met()`
      - `PrebuiltAssetsRequirement.summary()`
    - `Webpack`
      - `Webpack.__init__()`
      - `Webpack.assets_directory_path()`
      - `Webpack.filters`
      - `Webpack.new_context_vars()`
      - `Webpack.new_for_project()`
      - `Webpack.prebuild()`
      - `Webpack.public_css_paths`
      - `Webpack.register_event_handlers()`
      - `Webpack.requirement()`
- betty.project.extension.wikipedia package
  - Submodules
    - betty.project.extension.wikipedia.config module
      - `WikipediaConfiguration`
        - `WikipediaConfiguration.__init__()`
        - `WikipediaConfiguration.dump()`
        - `WikipediaConfiguration.load()`
        - `WikipediaConfiguration.populate_images`
  - Module contents
    - `Wikipedia`
      - `Wikipedia.__init__()`
      - `Wikipedia.assets_directory_path()`
      - `Wikipedia.filter_wikipedia_links()`
      - `Wikipedia.filters`
      - `Wikipedia.globals`
      - `Wikipedia.new_default_configuration()`
      - `Wikipedia.new_for_project()`
      - `Wikipedia.rate_limiter`
      - `Wikipedia.register_event_handlers()`
      - `Wikipedia.retriever`

## Module contents

Provide Betty’s extension API.

class betty.project.extension.ConfigurableExtension

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

  A configurable extension.

  async classmethod new_for_project(project: Project) → Self

    Create a new instance using the given project.

class betty.project.extension.Dependencies

  Bases: `AllRequirements`

  Check a dependent’s dependency requirements.

  __init__(dependent: type[Extension], extension_id_to_type_mapping: PluginIdToTypeMapping[Extension], dependency_requirements: Sequence[Requirement])

    This is private. It MUST NOT be used anywhere outside its containing scope.

  async classmethod new(dependent: type[Extension]) → Self

    Create a new instance.

  summary() → Localizable

    Get the requirement’s human-readable summary.

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

  The project extension plugin repository.

  Read more about Extension plugins.

class betty.project.extension.Extension

  Bases: `OrderedPlugin`[`Extension`], `DependentPlugin`[`Extension`], `ServiceProvider`, `ProjectDependentFactory`

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

  Read more about Extension plugins.

  To test your own subclasses, use `betty.test_utils.project.extension.ExtensionTestBase`.

  __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.

  async classmethod new_for_project(project: Project) → Self

    Create a new instance using the given project.

  property project: Project

    The project this extension runs within.

  register_event_handlers(registry: EventHandlerRegistry) → None

    Register event handlers with the project.

  async classmethod requirement() → Requirement

    Define the requirement for this extension to be enabled.

    This defaults to the extension’s dependencies.

class betty.project.extension.Theme

  Bases: `Extension`

  An extension that is a front-end theme.

async betty.project.extension.sort_extension_type_graph(sorter: TopologicalSorter[type[Extension]], extension_types: Iterable[type[Extension]]) → None

  Sort an extension graph.