betty.extension package

Subpackages

Module contents

Provide the built-in extensions.

class betty.extension.CottonCandy[source]

Bases: Theme, CssProvider, ConfigurableExtension[CottonCandyConfiguration], Generator, Jinja2Provider, WebpackEntryPointProvider

Provide Betty’s default front-end theme.

Parameters:
classmethod assets_directory_path() pathlib.Path[source]

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

This may be anywhere in your Python package.

Return type:

pathlib.Path

classmethod comes_after() set[type[betty.project.extension.Extension]][source]

The extensions that this one comes after.

The other extensions may or may not be enabled.

Return type:

set[type[betty.project.extension.Extension]]

classmethod default_configuration() betty.extension.cotton_candy.CottonCandyConfiguration[source]

Get this extension’s default configuration.

Return type:

betty.extension.cotton_candy.CottonCandyConfiguration

classmethod depends_on() set[type[betty.project.extension.Extension]][source]

The extensions this one depends on, and comes after.

Return type:

set[type[betty.project.extension.Extension]]

classmethod description() betty.locale.localizable.Localizable[source]

Get the human-readable extension description.

Return type:

betty.locale.localizable.Localizable

property filters: dict[str, Callable[[...], Any]]

Jinja2 filters provided by this extension.

Keys are filter names, and values are the filters themselves.

async generate(job_context: betty.generate.GenerationContext) None[source]

Generate (part of) a project’s site.

Parameters:

job_context (betty.generate.GenerationContext)

Return type:

None

property globals: dict[str, Any]

Jinja2 globals provided by this extension.

Keys are the globals’ names, and values are the globals’ values.

classmethod label() betty.locale.localizable.Localizable[source]

Get the human-readable extension label.

Return type:

betty.locale.localizable.Localizable

The path to the logo file.

classmethod name() str[source]

The machine name.

Return type:

str

property public_css_paths: list[str]

The public URL paths to the CSS files to include in each HTML page.

webpack_entry_point_cache_keys() collections.abc.Sequence[str][source]

Get the keys that make a Webpack build for this provider unique.

Providers that can be cached regardless may return ().

Return type:

collections.abc.Sequence[str]

classmethod webpack_entry_point_directory_path() pathlib.Path[source]

Get the path to the directory with the entry point assets.

The directory must include at least a package.json and main.ts.

Return type:

pathlib.Path

class betty.extension.Demo[source]

Bases: Extension, Loader

Provide demonstration site functionality.

Parameters:
classmethod depends_on() set[type[betty.project.extension.Extension]][source]

The extensions this one depends on, and comes after.

Return type:

set[type[betty.project.extension.Extension]]

async load() None[source]

Load ancestry data.

Return type:

None

classmethod name() str[source]

The machine name.

Return type:

str

class betty.extension.Deriver[source]

Bases: UserFacingExtension, PostLoader

Expand an ancestry by deriving additional data from existing data.

Parameters:
classmethod comes_before() set[type[betty.project.extension.Extension]][source]

The extensions that this one comes before.

The other extensions may or may not be enabled.

Return type:

set[type[betty.project.extension.Extension]]

classmethod description() betty.locale.localizable.Localizable[source]

Get the human-readable extension description.

Return type:

betty.locale.localizable.Localizable

classmethod label() betty.locale.localizable.Localizable[source]

Get the human-readable extension label.

Return type:

betty.locale.localizable.Localizable

classmethod name() str[source]

The machine name.

Return type:

str

async post_load() None[source]

Act on the ancestry having been loaded.

This method is called immediately after betty.load.Loader.load().

Return type:

None

class betty.extension.Gramps[source]

Bases: ConfigurableExtension[GrampsConfiguration], UserFacingExtension, Loader

Integrate Betty with Gramps.

Parameters:
classmethod default_configuration() betty.extension.gramps.config.GrampsConfiguration[source]

Get this extension’s default configuration.

Return type:

betty.extension.gramps.config.GrampsConfiguration

classmethod description() betty.locale.localizable.Localizable[source]

Get the human-readable extension description.

Return type:

betty.locale.localizable.Localizable

classmethod label() betty.locale.localizable.Localizable[source]

Get the human-readable extension label.

Return type:

betty.locale.localizable.Localizable

async load() None[source]

Load ancestry data.

Return type:

None

classmethod name() str[source]

The machine name.

Return type:

str

class betty.extension.HttpApiDoc[source]

Bases: UserFacingExtension, WebpackEntryPointProvider

Provide user-friendly HTTP API documentation.

Parameters:
classmethod assets_directory_path() pathlib.Path[source]

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

This may be anywhere in your Python package.

Return type:

pathlib.Path

classmethod depends_on() set[type[betty.project.extension.Extension]][source]

The extensions this one depends on, and comes after.

Return type:

set[type[betty.project.extension.Extension]]

classmethod description() betty.locale.localizable.Localizable[source]

Get the human-readable extension description.

Return type:

betty.locale.localizable.Localizable

classmethod label() betty.locale.localizable.Localizable[source]

Get the human-readable extension label.

Return type:

betty.locale.localizable.Localizable

classmethod name() str[source]

The machine name.

Return type:

str

webpack_entry_point_cache_keys() collections.abc.Sequence[str][source]

Get the keys that make a Webpack build for this provider unique.

Providers that can be cached regardless may return ().

Return type:

collections.abc.Sequence[str]

classmethod webpack_entry_point_directory_path() pathlib.Path[source]

Get the path to the directory with the entry point assets.

The directory must include at least a package.json and main.ts.

Return type:

pathlib.Path

class betty.extension.Maps[source]

Bases: UserFacingExtension, WebpackEntryPointProvider

Provide interactive maps for use on web pages.

Parameters:
classmethod assets_directory_path() pathlib.Path[source]

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

This may be anywhere in your Python package.

Return type:

pathlib.Path

classmethod depends_on() set[type[betty.project.extension.Extension]][source]

The extensions this one depends on, and comes after.

Return type:

set[type[betty.project.extension.Extension]]

classmethod description() betty.locale.localizable.Localizable[source]

Get the human-readable extension description.

Return type:

betty.locale.localizable.Localizable

classmethod label() betty.locale.localizable.Localizable[source]

Get the human-readable extension label.

Return type:

betty.locale.localizable.Localizable

classmethod name() str[source]

The machine name.

Return type:

str

webpack_entry_point_cache_keys() collections.abc.Sequence[str][source]

Get the keys that make a Webpack build for this provider unique.

Providers that can be cached regardless may return ().

Return type:

collections.abc.Sequence[str]

classmethod webpack_entry_point_directory_path() pathlib.Path[source]

Get the path to the directory with the entry point assets.

The directory must include at least a package.json and main.ts.

Return type:

pathlib.Path

class betty.extension.Nginx[source]

Bases: ConfigurableExtension[NginxConfiguration], UserFacingExtension, Generator

Integrate Betty with nginx (and Docker).

Parameters:
classmethod assets_directory_path() pathlib.Path | None[source]

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

This may be anywhere in your Python package.

Return type:

pathlib.Path | None

classmethod default_configuration() betty.extension.nginx.config.NginxConfiguration[source]

Get this extension’s default configuration.

Return type:

betty.extension.nginx.config.NginxConfiguration

classmethod description() betty.locale.localizable.Localizable[source]

Get the human-readable extension description.

Return type:

betty.locale.localizable.Localizable

async generate(job_context: betty.generate.GenerationContext) None[source]

Generate (part of) a project’s site.

Parameters:

job_context (betty.generate.GenerationContext)

Return type:

None

property https: bool

Whether the nginx server should use HTTPS.

classmethod label() betty.locale.localizable.Localizable[source]

Get the human-readable extension label.

Return type:

betty.locale.localizable.Localizable

property www_directory_path: str

The nginx server’s public web root directory path.

class betty.extension.Privatizer[source]

Bases: UserFacingExtension, PostLoader

Extend the Betty Application with privatization features.

Parameters:
classmethod description() betty.locale.localizable.Localizable[source]

Get the human-readable extension description.

Return type:

betty.locale.localizable.Localizable

classmethod label() betty.locale.localizable.Localizable[source]

Get the human-readable extension label.

Return type:

betty.locale.localizable.Localizable

classmethod name() str[source]

The machine name.

Return type:

str

async post_load() None[source]

Act on the ancestry having been loaded.

This method is called immediately after betty.load.Loader.load().

Return type:

None

privatize() None[source]

Privatize the project’s ancestry.

Return type:

None

class betty.extension.Trees[source]

Bases: UserFacingExtension, WebpackEntryPointProvider

Provide interactive family trees for use in web pages.

Parameters:
classmethod assets_directory_path() pathlib.Path[source]

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

This may be anywhere in your Python package.

Return type:

pathlib.Path

classmethod depends_on() set[type[betty.project.extension.Extension]][source]

The extensions this one depends on, and comes after.

Return type:

set[type[betty.project.extension.Extension]]

classmethod description() betty.locale.localizable.Localizable[source]

Get the human-readable extension description.

Return type:

betty.locale.localizable.Localizable

classmethod label() betty.locale.localizable.Localizable[source]

Get the human-readable extension label.

Return type:

betty.locale.localizable.Localizable

classmethod name() str[source]

The machine name.

Return type:

str

webpack_entry_point_cache_keys() collections.abc.Sequence[str][source]

Get the keys that make a Webpack build for this provider unique.

Providers that can be cached regardless may return ().

Return type:

collections.abc.Sequence[str]

classmethod webpack_entry_point_directory_path() pathlib.Path[source]

Get the path to the directory with the entry point assets.

The directory must include at least a package.json and main.ts.

Return type:

pathlib.Path

class betty.extension.Webpack[source]

Bases: Extension, CssProvider, Jinja2Provider, Generator

Integrate Betty with Webpack.

Parameters:
classmethod assets_directory_path() pathlib.Path[source]

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

This may be anywhere in your Python package.

Return type:

pathlib.Path

build_requirement() betty.requirement.Requirement[source]

Get the requirement that must be satisfied for Webpack builds to be available.

Return type:

betty.requirement.Requirement

classmethod enable_requirement() betty.requirement.Requirement[source]

Define the requirement for this extension to be enabled.

This defaults to the extension’s dependencies.

Return type:

betty.requirement.Requirement

property filters: dict[str, Callable[[...], Any]]

Jinja2 filters provided by this extension.

Keys are filter names, and values are the filters themselves.

async generate(job_context: betty.generate.GenerationContext) None[source]

Generate (part of) a project’s site.

Parameters:

job_context (betty.generate.GenerationContext)

Return type:

None

classmethod name() str[source]

The machine name.

Return type:

str

new_context_vars() dict[str, Any][source]

Create new variables for a new jinja2.runtime.Context.

Keys are the variable names, and values are variable values.

Return type:

dict[str, typing.Any]

async prebuild(job_context: betty.job.Context) None[source]

Prebuild the Webpack assets.

Parameters:

job_context (betty.job.Context)

Return type:

None

property public_css_paths: list[str]

The public URL paths to the CSS files to include in each HTML page.

class betty.extension.Wikipedia[source]

Bases: ConfigurableExtension[WikipediaConfiguration], UserFacingExtension, Jinja2Provider, PostLoader

Integrates Betty with Wikipedia.

Parameters:
__init__(*args: Any, **kwargs: Any)[source]
Parameters:
classmethod assets_directory_path() pathlib.Path | None[source]

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

This may be anywhere in your Python package.

Return type:

pathlib.Path | None

classmethod default_configuration() betty.extension.wikipedia.config.WikipediaConfiguration[source]

Get this extension’s default configuration.

Return type:

betty.extension.wikipedia.config.WikipediaConfiguration

classmethod description() betty.locale.localizable.Localizable[source]

Get the human-readable extension description.

Return type:

betty.locale.localizable.Localizable

property filters: dict[str, Callable[[...], Any]]

Jinja2 filters provided by this extension.

Keys are filter names, and values are the filters themselves.

classmethod label() betty.locale.localizable.Localizable[source]

Get the human-readable extension label.

Return type:

betty.locale.localizable.Localizable

classmethod name() str[source]

The machine name.

Return type:

str

async post_load() None[source]

Act on the ancestry having been loaded.

This method is called immediately after betty.load.Loader.load().

Return type:

None