plugins.registry.PluginRegistry

plugins.registry.PluginRegistry(specs=None, defaults=None, *, source=None)

The plugins this process knows about, and the instances it has open.

Parameters

Name Type Description Default
specs Mapping[str, PluginSpec] | None Name -> spec. None
defaults Mapping[str, str] | None Kind -> plugin name. None
source Path | None Where the config came from, for error messages. None

Methods

Name Description
close Close every open instance (tearing down spawned containers).
default_for The plugin name filling kind.
for_kind The (cached) plugin instance currently filling kind.
kinds Registered plugin names grouped by kind.
names Registered plugin names, sorted.
plugin The (cached) plugin instance registered under name.
register Add or replace a spec, closing any open instance under that name.
set_default Point kind at the plugin registered as name.
spec The spec registered under name.
unregister Remove a spec (and its default, and any open instance).
without A copy of this registry with every plugin of kinds left out.

close

plugins.registry.PluginRegistry.close()

Close every open instance (tearing down spawned containers).

default_for

plugins.registry.PluginRegistry.default_for(kind)

The plugin name filling kind.

Raises

Name Type Description
KeyError If no plugin declares that kind, if several do with no default set, or if the default names something unregistered.

for_kind

plugins.registry.PluginRegistry.for_kind(kind)

The (cached) plugin instance currently filling kind.

kinds

plugins.registry.PluginRegistry.kinds()

Registered plugin names grouped by kind.

names

plugins.registry.PluginRegistry.names()

Registered plugin names, sorted.

plugin

plugins.registry.PluginRegistry.plugin(name)

The (cached) plugin instance registered under name.

register

plugins.registry.PluginRegistry.register(spec, *, default=None)

Add or replace a spec, closing any open instance under that name.

Parameters

Name Type Description Default
spec PluginSpec The spec to register. required
default bool | None Make it the default for its kind (None: only when nothing else fills that kind yet). None

set_default

plugins.registry.PluginRegistry.set_default(kind, name)

Point kind at the plugin registered as name.

Raises

Name Type Description
KeyError If name is not registered.

spec

plugins.registry.PluginRegistry.spec(name)

The spec registered under name.

Raises

Name Type Description
KeyError If nothing is registered under that name.

unregister

plugins.registry.PluginRegistry.unregister(name)

Remove a spec (and its default, and any open instance).

Returns

Name Type Description
PluginSpec | None The removed spec, or None if nothing was registered under
PluginSpec | None name.

without

plugins.registry.PluginRegistry.without(kinds)

A copy of this registry with every plugin of kinds left out.

What :func:cadjoint.tier.absent installs so the public tier’s degraded behaviour can be exercised with the private providers still present in the process.