betty.app package

Submodules

Module contents

Define Betty’s core application functionality.

final class betty.app.App[source]

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)[source]
assets
binary_file_cache
cache
fetcher
http_client
localizer
localizers
multiprocessing_manager
classmethod new_from_environment() AsyncIterator[Self][source]

Create a new application from the environment.

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

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][source]

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