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

## Submodules

- betty.app.config module
  - `AppConfiguration`
    - `AppConfiguration.__init__()`
    - `AppConfiguration.dump()`
    - `AppConfiguration.load()`
    - `AppConfiguration.locale`
- betty.app.factory module
  - `AppDependentFactory`
    - `AppDependentFactory.new_for_app()`

## Module contents

Define Betty’s core application functionality.

final class betty.app.App

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

  The Betty application.

  This can be pickled.

  This is thread-safe, which means you can safely use this between different threads.

  This is process-safe, which means you can safely use this between different processes.

  __init__(configuration: AppConfiguration, cache_directory_path: Path, *, cache_factory: ServiceFactory[Self, Cache[Any]], fetcher: Fetcher | None = None, process_pool: futures.ProcessPoolExecutor | None = None, multiprocessing_manager: SyncManager | None = None)
  assets
  binary_file_cache
  cache
  fetcher
  http_client
  localizer
  localizers
  multiprocessing_manager
  classmethod new_from_environment() → AsyncIterator[Self]

    Create a new application from the environment.

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

    Create a new instance.

    Returns:

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

           `new()`’s return value.

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

           `new()`’s return value.

      3. 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(*, cache_factory: ServiceFactory[Self, Cache[Any]] | None = None, fetcher: Fetcher | None = None, process_pool: futures.ProcessPoolExecutor | None = None, multiprocessing_manager: SyncManager | None = None) → AsyncIterator[Self]

    Create a new, temporary, isolated application.

    The application will not use any persistent caches, or leave any traces on the system.

  process_pool
  spdx_license_repository