betty.project.config module¶
Provide project configuration.
- class betty.project.config.CopyrightNoticeConfiguration[source]¶
Bases:
PluginConfiguration
Configuration to define
betty.copyright_notice.CopyrightNotice
plugins.- __init__(plugin_id: MachineName, label: ShorthandStaticTranslations, *, summary: ShorthandStaticTranslations, text: ShorthandStaticTranslations, description: ShorthandStaticTranslations | None = None)[source]¶
- dump() MutableMapping[str, bool | int | float | str | None | MutableSequence[bool | int | float | str | None | MutableSequence[Dump] | MutableMapping[str, Dump]] | MutableMapping[str, bool | int | float | str | None | MutableSequence[Dump] | MutableMapping[str, Dump]]] [source]¶
Produce a serialized data dump of
self
.
- load(dump: bool | int | float | str | None | MutableSequence[Dump] | MutableMapping[str, Dump]) None [source]¶
Load a serialized data dump into
self
.- Raises:
betty.assertion.error.AssertionFailed – Raised if the dump is invalid.
- summary¶
An instance attribute that contains
betty.locale.localizable.config.StaticTranslationsLocalizableConfiguration
.
- text¶
An instance attribute that contains
betty.locale.localizable.config.StaticTranslationsLocalizableConfiguration
.
- class betty.project.config.CopyrightNoticeConfigurationMapping[source]¶
Bases:
PluginConfigurationMapping
[CopyrightNotice
,CopyrightNoticeConfiguration
]A configuration mapping for copyright notices.
- load_item(dump: bool | int | float | str | None | MutableSequence[Dump] | MutableMapping[str, Dump]) CopyrightNoticeConfiguration [source]¶
Create and load a new item from the given dump, or raise an assertion error.
- Raises:
betty.assertion.error.AssertionFailed – Raised when the dump is invalid and cannot be loaded.
- betty.project.config.DEFAULT_LIFETIME_THRESHOLD = 123¶
The default age by which people are presumed dead. This is based on Jeanne Louise Calment who is the oldest verified person to ever have lived.
- final class betty.project.config.EntityReference[source]¶
Bases:
Configuration
,Generic
[_EntityT
]Configuration that references an entity from the project’s ancestry.
- __init__(entity_type: type[_EntityT] | None = None, entity_id: str | None = None, *, entity_type_is_constrained: bool = False)[source]¶
- dump() MutableMapping[str, bool | int | float | str | None | MutableSequence[bool | int | float | str | None | MutableSequence[Dump] | MutableMapping[str, Dump]] | MutableMapping[str, bool | int | float | str | None | MutableSequence[Dump] | MutableMapping[str, Dump]]] | str | type[Void] [source]¶
Produce a serialized data dump of
self
.
- load(dump: bool | int | float | str | None | MutableSequence[Dump] | MutableMapping[str, Dump]) None [source]¶
Load a serialized data dump into
self
.- Raises:
betty.assertion.error.AssertionFailed – Raised if the dump is invalid.
- final class betty.project.config.EntityReferenceSequence[source]¶
Bases:
Generic
[_EntityT
],ConfigurationSequence
[EntityReference
[_EntityT
]]Configuration for a sequence of references to entities from the project’s ancestry.
- __init__(entity_references: Iterable[EntityReference[_EntityT]] | None = None, *, entity_type_constraint: type[_EntityT] | None = None)[source]¶
- load_item(dump: bool | int | float | str | None | MutableSequence[Dump] | MutableMapping[str, Dump]) EntityReference[_EntityT] [source]¶
Create and load a new item from the given dump, or raise an assertion error.
- Raises:
betty.assertion.error.AssertionFailed – Raised when the dump is invalid and cannot be loaded.
- final class betty.project.config.EntityTypeConfiguration[source]¶
Bases:
Configuration
Configure a single entity type for a project.
- dump() MutableMapping[str, bool | int | float | str | None | MutableSequence[bool | int | float | str | None | MutableSequence[Dump] | MutableMapping[str, Dump]] | MutableMapping[str, bool | int | float | str | None | MutableSequence[Dump] | MutableMapping[str, Dump]]] [source]¶
Produce a serialized data dump of
self
.
- load(dump: bool | int | float | str | None | MutableSequence[Dump] | MutableMapping[str, Dump]) None [source]¶
Load a serialized data dump into
self
.- Raises:
betty.assertion.error.AssertionFailed – Raised if the dump is invalid.
- final class betty.project.config.EntityTypeConfigurationMapping[source]¶
Bases:
ConfigurationMapping
[type
[Entity
],EntityTypeConfiguration
]Configure the entity types for a project.
- load_item(dump: bool | int | float | str | None | MutableSequence[Dump] | MutableMapping[str, Dump]) EntityTypeConfiguration [source]¶
Create and load a new item from the given dump, or raise an assertion error.
- Raises:
betty.assertion.error.AssertionFailed – Raised when the dump is invalid and cannot be loaded.
- class betty.project.config.EventTypeConfigurationMapping[source]¶
Bases:
PluginConfigurationPluginConfigurationMapping
[EventType
]A configuration mapping for event types.
- final class betty.project.config.ExtensionConfiguration[source]¶
Bases:
Configuration
Configure a single extension for a project.
- __init__(extension_type: type[Extension], *, enabled: bool = True, extension_configuration: Configuration | None = None)[source]¶
- dump() MutableMapping[str, bool | int | float | str | None | MutableSequence[bool | int | float | str | None | MutableSequence[Dump] | MutableMapping[str, Dump]] | MutableMapping[str, bool | int | float | str | None | MutableSequence[Dump] | MutableMapping[str, Dump]]] [source]¶
Produce a serialized data dump of
self
.
- property extension_configuration: Configuration | None¶
Get the extension’s own configuration.
- load(dump: bool | int | float | str | None | MutableSequence[Dump] | MutableMapping[str, Dump]) None [source]¶
Load a serialized data dump into
self
.- Raises:
betty.assertion.error.AssertionFailed – Raised if the dump is invalid.
- final class betty.project.config.ExtensionConfigurationMapping[source]¶
Bases:
ConfigurationMapping
[type
[Extension
],ExtensionConfiguration
]Configure a project’s extensions.
- __init__(configurations: Iterable[ExtensionConfiguration] | None = None)[source]¶
- load_item(dump: bool | int | float | str | None | MutableSequence[Dump] | MutableMapping[str, Dump]) ExtensionConfiguration [source]¶
Create and load a new item from the given dump, or raise an assertion error.
- Raises:
betty.assertion.error.AssertionFailed – Raised when the dump is invalid and cannot be loaded.
- class betty.project.config.GenderConfigurationMapping[source]¶
Bases:
PluginConfigurationPluginConfigurationMapping
[Gender
]A configuration mapping for genders.
- class betty.project.config.LicenseConfiguration[source]¶
Bases:
PluginConfiguration
Configuration to define
betty.license.License
plugins.- __init__(plugin_id: MachineName, label: ShorthandStaticTranslations, *, summary: ShorthandStaticTranslations, text: ShorthandStaticTranslations, description: ShorthandStaticTranslations | None = None)[source]¶
- dump() MutableMapping[str, bool | int | float | str | None | MutableSequence[bool | int | float | str | None | MutableSequence[Dump] | MutableMapping[str, Dump]] | MutableMapping[str, bool | int | float | str | None | MutableSequence[Dump] | MutableMapping[str, Dump]]] [source]¶
Produce a serialized data dump of
self
.
- load(dump: bool | int | float | str | None | MutableSequence[Dump] | MutableMapping[str, Dump]) None [source]¶
Load a serialized data dump into
self
.- Raises:
betty.assertion.error.AssertionFailed – Raised if the dump is invalid.
- summary¶
An instance attribute that contains
betty.locale.localizable.config.StaticTranslationsLocalizableConfiguration
.
- text¶
An instance attribute that contains
betty.locale.localizable.config.StaticTranslationsLocalizableConfiguration
.
- class betty.project.config.LicenseConfigurationMapping[source]¶
Bases:
PluginConfigurationMapping
[License
,LicenseConfiguration
]A configuration mapping for licenses.
- load_item(dump: bool | int | float | str | None | MutableSequence[Dump] | MutableMapping[str, Dump]) LicenseConfiguration [source]¶
Create and load a new item from the given dump, or raise an assertion error.
- Raises:
betty.assertion.error.AssertionFailed – Raised when the dump is invalid and cannot be loaded.
- final class betty.project.config.LocaleConfiguration[source]¶
Bases:
Configuration
Configure a single project locale.
- property alias: str¶
A shorthand alias to use instead of the full language tag, such as when rendering URLs.
- dump() bool | int | float | str | None | MutableSequence[bool | int | float | str | None | MutableSequence[Dump] | MutableMapping[str, Dump]] | MutableMapping[str, bool | int | float | str | None | MutableSequence[Dump] | MutableMapping[str, Dump]] | type[Void] [source]¶
Produce a serialized data dump of
self
.
- load(dump: bool | int | float | str | None | MutableSequence[Dump] | MutableMapping[str, Dump]) None [source]¶
Load a serialized data dump into
self
.- Raises:
betty.assertion.error.AssertionFailed – Raised if the dump is invalid.
- property locale: str¶
An IETF BCP 47 language tag.
- final class betty.project.config.LocaleConfigurationMapping[source]¶
Bases:
OrderedConfigurationMapping
[str
,LocaleConfiguration
]Configure a project’s locales.
- __init__(configurations: Iterable[LocaleConfiguration] | None = None)[source]¶
- property default: LocaleConfiguration¶
The default language.
- load_item(dump: bool | int | float | str | None | MutableSequence[Dump] | MutableMapping[str, Dump]) LocaleConfiguration [source]¶
Create and load a new item from the given dump, or raise an assertion error.
- Raises:
betty.assertion.error.AssertionFailed – Raised when the dump is invalid and cannot be loaded.
- replace(*configurations: LocaleConfiguration) None [source]¶
Replace any existing values with the given ones.
- class betty.project.config.PlaceTypeConfigurationMapping[source]¶
Bases:
PluginConfigurationPluginConfigurationMapping
[PlaceType
]A configuration mapping for place types.
- class betty.project.config.PresenceRoleConfigurationMapping[source]¶
Bases:
PluginConfigurationPluginConfigurationMapping
[PresenceRole
]A configuration mapping for presence roles.
- final class betty.project.config.ProjectConfiguration[source]¶
Bases:
Configuration
Provide the configuration for a
betty.project.Project
.- __init__(configuration_file_path: Path, *, available_formats: Sequence[type[Format]], url: str = 'https://example.com', clean_urls: bool = False, title: ShorthandStaticTranslations = 'Betty', author: ShorthandStaticTranslations | None = None, entity_types: Iterable[EntityTypeConfiguration] | None = None, event_types: Iterable[PluginConfiguration] | None = None, place_types: Iterable[PluginConfiguration] | None = None, presence_roles: Iterable[PluginConfiguration] | None = None, copyright_notice: MachineName | None = None, copyright_notices: Iterable[CopyrightNoticeConfiguration] | None = None, license: MachineName | None = None, licenses: Iterable[LicenseConfiguration] | None = None, genders: Iterable[PluginConfiguration] | None = None, extensions: Iterable[ExtensionConfiguration] | None = None, debug: bool = False, locales: Iterable[LocaleConfiguration] | None = None, lifetime_threshold: int = 123, name: MachineName | None = None, logo: Path | None = None)[source]¶
- property assets_directory_path: Path¶
- author¶
An instance attribute that contains
betty.locale.localizable.config.StaticTranslationsLocalizableConfiguration
.
- property base_url: str¶
The project’s public URL’s base URL.
If the public URL is
https://example.com
, the base URL ishttps://example.com
. If the public URL ishttps://example.com/my-ancestry-site
, the base URL ishttps://example.com
. If the public URL ishttps://my-ancestry-site.example.com
, the base URL ishttps://my-ancestry-site.example.com
.
- property clean_urls: bool¶
Whether to generate clean URLs such as
/person/first-person
instead of/person/first-person/index.html
.Generated artifacts will require web server that supports this.
- property configuration_file_path: Path¶
The path to the configuration’s file.
- copyright_notice: MachineName¶
The ID of the project-wide
betty.copyright_notice.CopyrightNotice
plugin to use.
- property copyright_notices: PluginConfigurationMapping[CopyrightNotice, CopyrightNoticeConfiguration]¶
The
betty.copyright_notice.CopyrightNotice
plugins created by this project.
- property debug: bool¶
Whether to enable debugging for project jobs.
This setting is disabled by default.
Enabling this generally results in:
More verbose logging output
job artifacts (e.g. generated sites)
- dump() MutableMapping[str, bool | int | float | str | None | MutableSequence[bool | int | float | str | None | MutableSequence[Dump] | MutableMapping[str, Dump]] | MutableMapping[str, bool | int | float | str | None | MutableSequence[Dump] | MutableMapping[str, Dump]]] [source]¶
Produce a serialized data dump of
self
.
- property entity_types: EntityTypeConfigurationMapping¶
The available entity types.
- property event_types: PluginConfigurationMapping[EventType, PluginConfiguration]¶
The event type plugins created by this project.
- property extensions: ExtensionConfigurationMapping¶
Then extensions running within this application.
- property genders: PluginConfigurationMapping[Gender, PluginConfiguration]¶
The gender plugins created by this project.
- license: MachineName¶
The ID of the project-wide
betty.license.License
plugin to use.
- property licenses: PluginConfigurationMapping[License, LicenseConfiguration]¶
The
betty.license.License
plugins created by this project.
- property lifetime_threshold: int¶
The lifetime threshold indicates when people are considered dead.
This setting defaults to
betty.project.config.DEFAULT_LIFETIME_THRESHOLD
.The value is an integer expressing the age in years over which people are presumed to have died.
- load(dump: bool | int | float | str | None | MutableSequence[Dump] | MutableMapping[str, Dump]) None [source]¶
Load a serialized data dump into
self
.- Raises:
betty.assertion.error.AssertionFailed – Raised if the dump is invalid.
- property locales: LocaleConfigurationMapping¶
The available locales.
- async classmethod new(configuration_file_path: Path, *, url: str = 'https://example.com', clean_urls: bool = False, title: ShorthandStaticTranslations = 'Betty', author: ShorthandStaticTranslations | None = None, entity_types: Iterable[EntityTypeConfiguration] | None = None, event_types: Iterable[PluginConfiguration] | None = None, place_types: Iterable[PluginConfiguration] | None = None, presence_roles: Iterable[PluginConfiguration] | None = None, copyright_notice: MachineName | None = None, copyright_notices: Iterable[CopyrightNoticeConfiguration] | None = None, license: MachineName | None = None, licenses: Iterable[LicenseConfiguration] | None = None, genders: Iterable[PluginConfiguration] | None = None, extensions: Iterable[ExtensionConfiguration] | None = None, debug: bool = False, locales: Iterable[LocaleConfiguration] | None = None, lifetime_threshold: int = 123, name: MachineName | None = None, logo: Path | None = None) Self [source]¶
Create a new instance.
- property output_directory_path: Path¶
The output directory path.
- property place_types: PluginConfigurationMapping[PlaceType, PluginConfiguration]¶
The place type plugins created by this project.
- property presence_roles: PluginConfigurationMapping[PresenceRole, PluginConfiguration]¶
The presence role plugins created by this project.
- property project_directory_path: Path¶
The project directory path.
Betty will look for resources in this directory, and place generated artifacts there. It is expected that no other applications or projects share this same directory.
- property root_path: str¶
The project’s public URL’s root path.
If the public URL is
https://example.com
, the root path is an empty string. If the public URL ishttps://example.com/my-ancestry-site
, the root path is/my-ancestry-site
.
- title¶
An instance attribute that contains
betty.locale.localizable.config.StaticTranslationsLocalizableConfiguration
.
- property www_directory_path: Path¶
The WWW directory path.