betty.services.plugin package#

Subpackages#

Submodules#

Module contents#

Service plugin management.

final class betty.services.plugin.PluginServiceInitializer#

Bases: ManagedLifeCycle

The plugin service initializer.

__init__(services: ServiceLevel, service_provider: PluginServiceProvider, supported_plugins: SupportedPlugins = (), /)#
class betty.services.plugin.PluginServiceManager#

Bases: ServiceManager[ServiceProviderT, GetServiceT, GetServiceT, Callable, GetServiceT], Generic

A plugin service manager.

__init__(plugin_type: type[PluginDefinitionT], /, *, auto: bool = True)#
final add_init_plugins(service_provider: ServiceProviderT, /, *plugins: InitT | ResolvablePluginDefinition[PluginDefinitionT]) None#

Add one or more plugins to initialize.

final assert_plugins_initialized(service_provider: ServiceProviderT, /) None#

Assert that the plugins have been initialized already for the given service provider.

Raises:

ServiceNotYetInitialized

final assert_plugins_not_initialized(service_provider: ServiceProviderT, /) None#

Assert that the plugins have not yet been initialized for the given service provider.

Raises:

ServiceAlreadyInitialized

auto: Final[bool]#

Whether to automatically initialize plugins that declare themselves able to be enabled automatically.

final get_init_plugins(service_provider: ServiceProviderT, /) Iterable[InitT | ResolvablePluginDefinition[PluginDefinitionT]]#

Get the initial plugins for the given service provider.

final get_plugins(service_provider: ServiceProviderT, /) Sequence[InitT | ResolvablePluginDefinition[PluginDefinitionT]]#

Get the initialized plugins.

init_owner(service_provider: ServiceProviderT, /) None#

Initialize the property on an owner.

final async init_plugins(service_provider: ServiceProviderT, /, *plugins: InitT | ResolvablePluginDefinition[PluginDefinitionT]) None#

Initialize the plugins.

abstractmethod new_service(service_provider: ServiceProviderT, /) GetServiceT#

Create the new service value for the given service provider.

plugin_type: Final[type[PluginDefinitionT]]#

The type of service plugin.

async prepare_plugins(service_provider: ServiceProviderT, /, *plugins: InitT | ResolvablePluginDefinition[PluginDefinitionT]) Iterable[InitT | ResolvablePluginDefinition[PluginDefinitionT]]#

Prepare the init plugins before the service is initialized.

Perform actions such as validation or ordering here.

require: Final[_PluginServiceRequirementGetter]#
resolve_init_plugin_id(plugin: InitT | ResolvablePluginDefinition[PluginDefinitionT], /) MachineName#

Resolve a service plugin definition to its plugin ID.

class betty.services.plugin.PluginServiceProvider#

Bases: ManagedLifeCycle, ServiceProvider

A plugin service provider.

__init__(*args: Any, services: ServiceLevel, supported_plugins: SupportedPlugins = (), **kwargs: Any)#