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

## Subpackages

- 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
    - `ConfigurableExtension`
      - `ConfigurableExtension.new_for_project()`
    - `Dependencies`
      - `Dependencies.__init__()`
      - `Dependencies.new()`
      - `Dependencies.summary()`
    - `EXTENSION_REPOSITORY`
    - `Extension`
      - `Extension.__init__()`
      - `Extension.assets_directory_path()`
      - `Extension.new_for_project()`
      - `Extension.project`
      - `Extension.register_event_handlers()`
      - `Extension.requirement()`
    - `Theme`
    - `sort_extension_type_graph()`
- betty.project.generate package
  - Submodules
    - betty.project.generate.file module
      - `create_file()`
      - `create_html_resource()`
      - `create_json_resource()`
  - Module contents
    - `GenerateSiteEvent`
    - `generate()`

## Submodules

- betty.project.config module
  - `CopyrightNoticeConfiguration`
    - `CopyrightNoticeConfiguration.__init__()`
    - `CopyrightNoticeConfiguration.dump()`
    - `CopyrightNoticeConfiguration.load()`
    - `CopyrightNoticeConfiguration.summary`
    - `CopyrightNoticeConfiguration.text`
  - `CopyrightNoticeConfigurationMapping`
  - `DEFAULT_LIFETIME_THRESHOLD`
  - `EntityTypeConfiguration`
    - `EntityTypeConfiguration.__init__()`
    - `EntityTypeConfiguration.dump()`
    - `EntityTypeConfiguration.generate_html_list`
    - `EntityTypeConfiguration.id`
    - `EntityTypeConfiguration.load()`
    - `EntityTypeConfiguration.validate()`
  - `EntityTypeConfigurationMapping`
    - `EntityTypeConfigurationMapping.validate()`
  - `EventTypeConfigurationMapping`
  - `ExtensionInstanceConfigurationMapping`
    - `ExtensionInstanceConfigurationMapping.enable()`
  - `GenderConfigurationMapping`
  - `LicenseConfiguration`
    - `LicenseConfiguration.__init__()`
    - `LicenseConfiguration.dump()`
    - `LicenseConfiguration.load()`
    - `LicenseConfiguration.summary`
    - `LicenseConfiguration.text`
  - `LicenseConfigurationMapping`
  - `LocaleConfiguration`
    - `LocaleConfiguration.__init__()`
    - `LocaleConfiguration.alias`
    - `LocaleConfiguration.dump()`
    - `LocaleConfiguration.load()`
    - `LocaleConfiguration.locale`
  - `LocaleConfigurationMapping`
    - `LocaleConfigurationMapping.__init__()`
    - `LocaleConfigurationMapping.default`
    - `LocaleConfigurationMapping.multilingual`
    - `LocaleConfigurationMapping.replace()`
  - `PlaceTypeConfigurationMapping`
  - `PresenceRoleConfigurationMapping`
  - `ProjectConfiguration`
    - `ProjectConfiguration.__init__()`
    - `ProjectConfiguration.assets_directory_path`
    - `ProjectConfiguration.author`
    - `ProjectConfiguration.base_url`
    - `ProjectConfiguration.clean_urls`
    - `ProjectConfiguration.configuration_file_path`
    - `ProjectConfiguration.copyright_notice`
    - `ProjectConfiguration.copyright_notices`
    - `ProjectConfiguration.debug`
    - `ProjectConfiguration.dump()`
    - `ProjectConfiguration.entity_types`
    - `ProjectConfiguration.event_types`
    - `ProjectConfiguration.extensions`
    - `ProjectConfiguration.genders`
    - `ProjectConfiguration.license`
    - `ProjectConfiguration.licenses`
    - `ProjectConfiguration.lifetime_threshold`
    - `ProjectConfiguration.load()`
    - `ProjectConfiguration.locales`
    - `ProjectConfiguration.localize_www_directory_path()`
    - `ProjectConfiguration.logo`
    - `ProjectConfiguration.name`
    - `ProjectConfiguration.new()`
    - `ProjectConfiguration.output_directory_path`
    - `ProjectConfiguration.place_types`
    - `ProjectConfiguration.presence_roles`
    - `ProjectConfiguration.project_directory_path`
    - `ProjectConfiguration.root_path`
    - `ProjectConfiguration.title`
    - `ProjectConfiguration.url`
    - `ProjectConfiguration.www_directory_path`
- betty.project.factory module
  - `ProjectDependentFactory`
    - `ProjectDependentFactory.new_for_project()`
- betty.project.load module
  - `LoadAncestryEvent`
  - `PostLoadAncestryEvent`
  - `load()`
- betty.project.url module
  - `LocalizedUrlGenerator`
    - `LocalizedUrlGenerator.__init__()`
    - `LocalizedUrlGenerator.__new__()`
    - `LocalizedUrlGenerator.generate()`
    - `LocalizedUrlGenerator.new_for_project()`
    - `LocalizedUrlGenerator.supports()`
  - `StaticUrlGenerator`
    - `StaticUrlGenerator.__new__()`
    - `StaticUrlGenerator.generate()`
    - `StaticUrlGenerator.supports()`
  - `new_project_url_generator()`

## Module contents

Provide the project API.

Projects are how people use Betty. A project is a workspace, starting out with the user’s configuration, and combining it with the resulting ancestry, allowing the user to perform tasks, such as generating a site from the entire project.

final class betty.project.Project

  Bases: `Configurable`[`ProjectConfiguration`], `TargetFactory`, `ServiceProvider`

  Define a Betty project.

  A project combines project configuration and the resulting ancestry.

  __init__(app: App, configuration: ProjectConfiguration, *, ancestry: Ancestry)
  property ancestry: Ancestry

    The project’s ancestry.

  property app: App

    The application this project is run within.

  assets
  async bootstrap() → None

    Bootstrap the component.

  copyright_notice
  copyright_notice_repository
  entity_type_repository
  event_dispatcher
  event_type_repository
  extension_repository
  extensions
  gender_repository
  jinja2_environment
  license
  license_repository
  localized_url_generator
  localizers
  property logo: Path

    The path to the logo file.

  property name: MachineName

    The project name.

    If no project name was configured, this defaults to the hash of the configuration file path.

  async classmethod new(app: App, *, configuration: ProjectConfiguration, ancestry: Ancestry | None = None) → Self

    Create a new instance.

  async new_target(cls: type[_T]) → _T

    Create a new instance.

    Returns:

      1. If `cls` extends `betty.project.factory.ProjectDependentFactory`, this will call return

           `cls`’s `new()`’s return value.

      2. If `cls` extends `betty.app.factory.AppDependentFactory`, this will call return `cls`’s

           `new()`’s return value.

      3. If `cls` extends `betty.factory.IndependentFactory`, this will call return `cls`’s

           `new()`’s return value.

      4. Otherwise `cls()` will be called without arguments, and the resulting instance will be returned.

    Raises:

      FactoryError – raised when `cls` could not be instantiated.

  classmethod new_temporary(app: App, *, configuration: ProjectConfiguration | None = None, ancestry: Ancestry | None = None) → AsyncIterator[Self]

    Creat a new, temporary, isolated project.

    The project will not leave any traces on the system, except when it uses global Betty functionality such as caches.

  place_type_repository
  presence_role_repository
  renderer
  static_url_generator
  url_generator

class betty.project.ProjectContext

  Bases: `Context`

  A job context for a project.

  __init__(project: Project, manager: SyncManager | None = None)
  property project: Project

    The Betty project this job context is run within.

class betty.project.ProjectEvent

  Bases: `Event`

  An event that is dispatched within the context of a `betty.project.Project`.

  __init__(job_context: ProjectContext)
  property job_context: ProjectContext

    The site generation job context.

  property project: Project

    The `betty.project.Project` this event is dispatched within.

final class betty.project.ProjectExtensions

  Bases: `object`

  Manage the extensions running within the `betty.project.Project`.

  This is internal. It MAY be used anywhere in Betty’s source code, but MUST NOT be used by third-party code.

  __init__(project_extensions: Sequence[Sequence[Extension]])
  flatten() → Iterator[Extension]

    Get a sequence of topologically sorted extensions.

final class betty.project.ProjectSchema

  Bases: `ProjectDependentFactory`, `Schema`

  A JSON Schema for a project.

  async classmethod def_url(project: Project, def_name: str) → str

    Get the URL to a project’s JSON Schema definition.

  async classmethod new_for_project(project: Project) → Self

    Create a new instance using the given project.

  async classmethod url(project: Project) → str

    Get the URL to a project’s JSON Schema.

  classmethod www_path(project: Project) → Path

    Get the path to the schema file in a site’s public WWW directory.