betty.plugin.discovery module

Plugin discovery.

final class betty.plugin.discovery.PluginDiscoverer

Bases: Generic

Discover plugin definitions of a specific plugin type.

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

__init__(services: ServiceLevel, plugin_type: builtins.type[PluginDefinitionT], plugin_overrides: Iterable[ResolvableDiscovery[PluginDefinition]] | None = None, /)
async get(key: ResolvablePluginId) PluginDefinitionT

Get a plugin by its ID.

async ids() Iterable[MachineName]

Iterate over the IDs of the available plugins.

property type: builtins.type[PluginDefinitionT]

The plugin type.

final class betty.plugin.discovery.PluginDiscovererCollection

Bases: ErroringKeyedCollection[MachineName, type[PluginDefinition] | MachineName | str, PluginDiscoverer]

A collection of plugin discoverers.

async betty.plugin.discovery.discover(services: ServiceLevel, *discoveries: ResolvableDiscovery) Iterable

Discover plugins definitions.