# Extension Manager Classes

## DriverManager

class stevedore.driver.DriverManager(namespace: str, name: str, invoke_on_load: bool = False, invoke_args: tuple[~typing.Any, ...] | None = None, invoke_kwds: dict[str, ~typing.Any] | None = None, on_load_failure_callback: OnLoadFailureCallbackT[T] | None = None, on_missing_entrypoints_callback: ~collections.abc.Callable[[~collections.abc.Iterable[str]], None] | None = <function warning_on_missing_entrypoint>, verify_requirements: bool | None = None, warn_on_missing_entrypoint: bool | None = None, *, conflict_resolver: ConflictResolverT[T] = <function ignore_conflicts>)

  Bases: `NamedExtensionManager`[`T`]

  Load a single plugin with a given name from the namespace.

  Parameters:

    - namespace – The namespace for the entry points.

    - name – The name of the driver to load.

    - invoke_on_load – Boolean controlling whether to invoke the object returned by the entry point after the driver is loaded.

    - invoke_args – Positional arguments to pass when invoking the object returned by the entry point. Only used if invoke_on_load is True.

    - invoke_kwds – Named arguments to pass when invoking the object returned by the entry point. Only used if invoke_on_load is True.

    - on_load_failure_callback – Callback function that will be called when an entrypoint can not be loaded. The arguments that will be provided when this is called (when an entrypoint fails to load) are (manager, entrypoint, exception)

    - on_missing_entrypoints_callback – Callback function that will be called when one or more names cannot be found. The provided argument will be a subset of the ‘names’ parameter.

    - verify_requirements – DEPRECATED This is a no-op and will be removed in a future version.

    - warn_on_missing_entrypoint – DEPRECATED Flag to control whether failing to load a plugin is reported via a log mess. Only applies if on_missing_entrypoints_callback is None. Users should instead set `on_missing_entrypoints_callback` to `None` if they wish to disable logging.

    - conflict_resolver – A callable that determines what to do in the event that there are multiple entrypoints in the same group with the same name. This is only used if retrieving entrypoint by name.

  __call__(func: Callable[[Concatenate[Extension[T], P]], U], *args: Any, **kwds: Any) → U | None

    Invokes func() for the single loaded extension.

    The signature for func() should be:

        def func(ext, *args, **kwds):
            pass

    The first argument to func(), ‘ext’, is the `Extension` instance.

    Exceptions raised from within func() are logged and ignored.

    Parameters:

      - func – Callable to invoke for each extension.

      - args – Variable arguments to pass to func()

      - kwds – Keyword arguments to pass to func()

    Returns:

      List of values returned from func()

  __init__(namespace: str, name: str, invoke_on_load: bool = False, invoke_args: tuple[~typing.Any, ...] | None = None, invoke_kwds: dict[str, ~typing.Any] | None = None, on_load_failure_callback: OnLoadFailureCallbackT[T] | None = None, on_missing_entrypoints_callback: ~collections.abc.Callable[[~collections.abc.Iterable[str]], None] | None = <function warning_on_missing_entrypoint>, verify_requirements: bool | None = None, warn_on_missing_entrypoint: bool | None = None, *, conflict_resolver: ConflictResolverT[T] = <function ignore_conflicts>) → None
  property driver: T | Callable[[...], T]

    Returns the driver being used by this manager.

  classmethod make_test_instance(extension: ~stevedore.extension.Extension[~stevedore.driver.T], namespace: str = 'TESTING', propagate_map_exceptions: bool = False, on_load_failure_callback: OnLoadFailureCallbackT[T] | None = None, verify_requirements: bool | None = None, *, conflict_resolver: ConflictResolverT[T] = <function ignore_conflicts>) → Self

    Construct a test DriverManager

    Test instances are passed a list of extensions to work from rather than loading them from entry points.

    Parameters:

      - extension – Pre-configured Extension instance

      - namespace – The namespace for the manager; used only for identification since the extensions are passed in.

      - propagate_map_exceptions – Boolean controlling whether exceptions are propagated up through the map call or whether they are logged and then ignored

      - on_load_failure_callback – Callback function that will be called when an entrypoint can not be loaded. The arguments that will be provided when this is called (when an entrypoint fails to load) are (manager, entrypoint, exception)

      - verify_requirements – DEPRECATED This is a no-op and will be removed in a future version.

      - conflict_resolver – A callable that determines what to do in the event that there are multiple entrypoints in the same group with the same name. This is only used if retrieving entrypoint by name.

    Returns:

      The manager instance, initialized for testing

## HookManager

class stevedore.hook.HookManager(namespace: str, name: str, invoke_on_load: bool = False, invoke_args: tuple[~typing.Any, ...] | None = None, invoke_kwds: dict[str, ~typing.Any] | None = None, on_load_failure_callback: OnLoadFailureCallbackT[T] | None = None, on_missing_entrypoints_callback: ~collections.abc.Callable[[~collections.abc.Iterable[str]], None] | None = None, verify_requirements: bool | None = None, warn_on_missing_entrypoint: bool | None = None, *, conflict_resolver: ConflictResolverT[T] = <function ignore_conflicts>)

  Bases: `NamedExtensionManager`[`T`]

  Coordinate execution of multiple extensions using a common name.

  Parameters:

    - namespace – The namespace for the entry points.

    - name – The name of the hooks to load.

    - invoke_on_load – Boolean controlling whether to invoke the object returned by the entry point after the driver is loaded.

    - invoke_args – Positional arguments to pass when invoking the object returned by the entry point. Only used if invoke_on_load is True.

    - invoke_kwds – Named arguments to pass when invoking the object returned by the entry point. Only used if invoke_on_load is True.

    - on_load_failure_callback – Callback function that will be called when an entrypoint can not be loaded. The arguments that will be provided when this is called (when an entrypoint fails to load) are (manager, entrypoint, exception)

    - on_missing_entrypoints_callback – Callback function that will be called when one or more names cannot be found. The provided argument will be a subset of the ‘names’ parameter.

    - verify_requirements – DEPRECATED This is a no-op and will be removed in a future version.

    - warn_on_missing_entrypoint – DEPRECATED Flag to control whether failing to load a plugin is reported via a log mess. Only applies if on_missing_entrypoints_callback is None. Users should instead set `on_missing_entrypoints_callback` to `None` if they wish to disable logging.

    - conflict_resolver – A callable that determines what to do in the event that there are multiple entrypoints in the same group with the same name. This is only used if retrieving entrypoint by name.

  __getitem__(name: str) → list[Extension[T]]

    Return the named extensions.

    Accessing a HookManager as a dictionary (`em['name']`) produces a list of the `Extension` instance(s) with the specified name, in the order they would be invoked by map().

  __init__(namespace: str, name: str, invoke_on_load: bool = False, invoke_args: tuple[~typing.Any, ...] | None = None, invoke_kwds: dict[str, ~typing.Any] | None = None, on_load_failure_callback: OnLoadFailureCallbackT[T] | None = None, on_missing_entrypoints_callback: ~collections.abc.Callable[[~collections.abc.Iterable[str]], None] | None = None, verify_requirements: bool | None = None, warn_on_missing_entrypoint: bool | None = None, *, conflict_resolver: ConflictResolverT[T] = <function ignore_conflicts>)

## NamedExtensionManager

class stevedore.named.NamedExtensionManager(namespace: str, names: ~collections.abc.Sequence[str], invoke_on_load: bool = False, invoke_args: tuple[~typing.Any, ...] | None = None, invoke_kwds: dict[str, ~typing.Any] | None = None, name_order: bool = False, propagate_map_exceptions: bool = False, on_load_failure_callback: OnLoadFailureCallbackT[T] | None = None, on_missing_entrypoints_callback: ~collections.abc.Callable[[~collections.abc.Iterable[str]], None] | None = <function warning_on_missing_entrypoint>, verify_requirements: bool | None = None, warn_on_missing_entrypoint: bool | None = None, *, conflict_resolver: ConflictResolverT[T] = <function ignore_conflicts>)

  Bases: `ExtensionManager`[`T`]

  Loads only the named extensions.

  This is useful for explicitly enabling extensions in a configuration file, for example.

  Parameters:

    - namespace – The namespace for the entry points.

    - names – The names of the extensions to load.

    - invoke_on_load – Boolean controlling whether to invoke the object returned by the entry point after the driver is loaded.

    - invoke_args – Positional arguments to pass when invoking the object returned by the entry point. Only used if invoke_on_load is True.

    - invoke_kwds – Named arguments to pass when invoking the object returned by the entry point. Only used if invoke_on_load is True.

    - name_order – If true, sort the loaded extensions to match the order used in `names`.

    - propagate_map_exceptions – Boolean controlling whether exceptions are propagated up through the map call or whether they are logged and then ignored

    - on_load_failure_callback – Callback function that will be called when an entrypoint can not be loaded. The arguments that will be provided when this is called (when an entrypoint fails to load) are (manager, entrypoint, exception)

    - on_missing_entrypoints_callback – Callback function that will be called when one or more names cannot be found. The provided argument will be a subset of the ‘names’ parameter.

    - verify_requirements – DEPRECATED This is a no-op and will be removed in a future version.

    - warn_on_missing_entrypoint – DEPRECATED Flag to control whether failing to load a plugin is reported via a log mess. Only applies if on_missing_entrypoints_callback is None. Users should instead set `on_missing_entrypoints_callback` to `None` if they wish to disable logging.

    - conflict_resolver – A callable that determines what to do in the event that there are multiple entrypoints in the same group with the same name. This is only used if retrieving entrypoint by name.

  __init__(namespace: str, names: ~collections.abc.Sequence[str], invoke_on_load: bool = False, invoke_args: tuple[~typing.Any, ...] | None = None, invoke_kwds: dict[str, ~typing.Any] | None = None, name_order: bool = False, propagate_map_exceptions: bool = False, on_load_failure_callback: OnLoadFailureCallbackT[T] | None = None, on_missing_entrypoints_callback: ~collections.abc.Callable[[~collections.abc.Iterable[str]], None] | None = <function warning_on_missing_entrypoint>, verify_requirements: bool | None = None, warn_on_missing_entrypoint: bool | None = None, *, conflict_resolver: ConflictResolverT[T] = <function ignore_conflicts>) → None
  classmethod make_test_instance(extensions: list[~stevedore.extension.Extension[~stevedore.named.T]], namespace: str = 'TESTING', propagate_map_exceptions: bool = False, on_load_failure_callback: OnLoadFailureCallbackT[T] | None = None, verify_requirements: bool | None = None, *, conflict_resolver: ConflictResolverT[T] = <function ignore_conflicts>) → Self

    Construct a test NamedExtensionManager

    Test instances are passed a list of extensions to use rather than loading them from entry points.

    Parameters:

      - extensions – Pre-configured Extension instances

      - namespace – The namespace for the manager; used only for identification since the extensions are passed in.

      - propagate_map_exceptions – Boolean controlling whether exceptions are propagated up through the map call or whether they are logged and then ignored

      - on_load_failure_callback – Callback function that will be called when an entrypoint can not be loaded. The arguments that will be provided when this is called (when an entrypoint fails to load) are (manager, entrypoint, exception)

      - verify_requirements – DEPRECATED This is a no-op and will be removed in a future version.

      - conflict_resolver – A callable that determines what to do in the event that there are multiple entrypoints in the same group with the same name. This is only used if retrieving entrypoint by name.

    Returns:

      The manager instance, initialized for testing

## EnabledExtensionManager

class stevedore.enabled.EnabledExtensionManager(namespace: str, check_func: ~collections.abc.Callable[[~stevedore.extension.Extension[~stevedore.enabled.T]], bool], invoke_on_load: bool = False, invoke_args: tuple[~typing.Any, ...] | None = None, invoke_kwds: dict[str, ~typing.Any] | None = None, propagate_map_exceptions: bool = False, on_load_failure_callback: OnLoadFailureCallbackT[T] | None = None, verify_requirements: bool | None = None, *, conflict_resolver: ConflictResolverT[T] = <function ignore_conflicts>)

  Bases: `ExtensionManager`[`T`]

  Loads only plugins that pass a check function.

  The check_func argument should return a boolean, with `True` indicating that the extension should be loaded and made available and `False` indicating that the extension should be ignored.

  Parameters:

    - namespace – The namespace for the entry points.

    - check_func – Function to determine which extensions to load.

    - invoke_on_load – Boolean controlling whether to invoke the object returned by the entry point after the driver is loaded.

    - invoke_args – Positional arguments to pass when invoking the object returned by the entry point. Only used if invoke_on_load is True.

    - invoke_kwds – Named arguments to pass when invoking the object returned by the entry point. Only used if invoke_on_load is True.

    - propagate_map_exceptions – Boolean controlling whether exceptions are propagated up through the map call or whether they are logged and then ignored

    - on_load_failure_callback – Callback function that will be called when an entrypoint can not be loaded. The arguments that will be provided when this is called (when an entrypoint fails to load) are (manager, entrypoint, exception)

    - verify_requirements – DEPRECATED This is a no-op and will be removed in a future version.

    - conflict_resolver – A callable that determines what to do in the event that there are multiple entrypoints in the same group with the same name. This is only used if retrieving entrypoint by name.

  __init__(namespace: str, check_func: ~collections.abc.Callable[[~stevedore.extension.Extension[~stevedore.enabled.T]], bool], invoke_on_load: bool = False, invoke_args: tuple[~typing.Any, ...] | None = None, invoke_kwds: dict[str, ~typing.Any] | None = None, propagate_map_exceptions: bool = False, on_load_failure_callback: OnLoadFailureCallbackT[T] | None = None, verify_requirements: bool | None = None, *, conflict_resolver: ConflictResolverT[T] = <function ignore_conflicts>)

## DispatchExtensionManager

class stevedore.dispatch.DispatchExtensionManager(namespace: str, check_func: ~collections.abc.Callable[[~stevedore.extension.Extension[~stevedore.enabled.T]], bool], invoke_on_load: bool = False, invoke_args: tuple[~typing.Any, ...] | None = None, invoke_kwds: dict[str, ~typing.Any] | None = None, propagate_map_exceptions: bool = False, on_load_failure_callback: OnLoadFailureCallbackT[T] | None = None, verify_requirements: bool | None = None, *, conflict_resolver: ConflictResolverT[T] = <function ignore_conflicts>)

  Bases: `EnabledExtensionManager`[`T`]

  Loads all plugins and filters on execution.

  This is useful for long-running processes that need to pass different inputs to different extensions.

  Parameters:

    - namespace – The namespace for the entry points.

    - check_func – Function to determine which extensions to load.

    - invoke_on_load – Boolean controlling whether to invoke the object returned by the entry point after the driver is loaded.

    - invoke_args – Positional arguments to pass when invoking the object returned by the entry point. Only used if invoke_on_load is True.

    - invoke_kwds – Named arguments to pass when invoking the object returned by the entry point. Only used if invoke_on_load is True.

    - propagate_map_exceptions – Boolean controlling whether exceptions are propagated up through the map call or whether they are logged and then ignored

  map(filter_func: Callable[[Concatenate[Extension[T], P]], bool], func: Callable[[Concatenate[Extension[T], Q]], U], *args: Any, **kwds: Any) → list[U]

    Iterate over the extensions invoking func() for any where filter_func() returns True.

    The signature of filter_func() should be:

        def filter_func(ext, *args, **kwds):
            pass

    The first argument to filter_func(), ‘ext’, is the `Extension` instance. filter_func() should return True if the extension should be invoked for the input arguments.

    The signature for func() should be:

        def func(ext, *args, **kwds):
            pass

    The first argument to func(), ‘ext’, is the `Extension` instance.

    Exceptions raised from within func() are propagated up and processing stopped if self.propagate_map_exceptions is True, otherwise they are logged and ignored.

    Parameters:

      - filter_func – Callable to test each extension.

      - func – Callable to invoke for each extension.

      - args – Variable arguments to pass to func()

      - kwds – Keyword arguments to pass to func()

    Returns:

      List of values returned from func()

  map_method(filter_func: Callable[[Concatenate[Extension[T], P]], bool], method_name: str, *args: Any, **kwds: Any) → Any

    Iterate over the extensions invoking each one’s object method called method_name for any where filter_func() returns True.

    This is equivalent of using `map()` with func set to lambda x: x.obj.method_name() while being more convenient.

    Exceptions raised from within the called method are propagated up and processing stopped if self.propagate_map_exceptions is True, otherwise they are logged and ignored.

    Added in version 0.12.

    Parameters:

      - filter_func – Callable to test each extension.

      - method_name – The extension method name to call for each extension.

      - args – Variable arguments to pass to method

      - kwds – Keyword arguments to pass to method

    Returns:

      List of values returned from methods

## NameDispatchExtensionManager

class stevedore.dispatch.NameDispatchExtensionManager(namespace: str, check_func: Callable[[Extension[T]], bool], invoke_on_load: bool = False, invoke_args: tuple[Any, ...] | None = None, invoke_kwds: dict[str, Any] | None = None, propagate_map_exceptions: bool = False, on_load_failure_callback: OnLoadFailureCallbackT[T] | None = None, verify_requirements: bool | None = None)

  Bases: `DispatchExtensionManager`[`T`]

  Loads all plugins and filters on execution.

  This is useful for long-running processes that need to pass different inputs to different extensions and can predict the name of the extensions before calling them.

  The check_func argument should return a boolean, with `True` indicating that the extension should be loaded and made available and `False` indicating that the extension should be ignored.

  Parameters:

    - namespace – The namespace for the entry points.

    - check_func – Function to determine which extensions to load.

    - invoke_on_load – Boolean controlling whether to invoke the object returned by the entry point after the driver is loaded.

    - invoke_args – Positional arguments to pass when invoking the object returned by the entry point. Only used if invoke_on_load is True.

    - invoke_kwds – Named arguments to pass when invoking the object returned by the entry point. Only used if invoke_on_load is True.

    - propagate_map_exceptions – Boolean controlling whether exceptions are propagated up through the map call or whether they are logged and then ignored

    - on_load_failure_callback – Callback function that will be called when an entrypoint can not be loaded. The arguments that will be provided when this is called (when an entrypoint fails to load) are (manager, entrypoint, exception)

    - verify_requirements – DEPRECATED This is a no-op and will be removed in a future version.

  __init__(namespace: str, check_func: Callable[[Extension[T]], bool], invoke_on_load: bool = False, invoke_args: tuple[Any, ...] | None = None, invoke_kwds: dict[str, Any] | None = None, propagate_map_exceptions: bool = False, on_load_failure_callback: OnLoadFailureCallbackT[T] | None = None, verify_requirements: bool | None = None)
  map(names: ~collections.abc.Sequence[str], func: ~collections.abc.Callable[[~typing.Concatenate[~stevedore.extension.Extension[~stevedore.dispatch.T], ~P]], ~stevedore.dispatch.U], *args: ~typing.~P, **kwds: ~typing.~P) → list[U]

    Iterate over the extensions invoking func() for any where the name is in the given list of names.

    The signature for func() should be:

        def func(ext, *args, **kwds):
            pass

    The first argument to func(), ‘ext’, is the `Extension` instance.

    Exceptions raised from within func() are propagated up and processing stopped if self.propagate_map_exceptions is True, otherwise they are logged and ignored.

    Parameters:

      - names – List or set of name(s) of extension(s) to invoke.

      - func – Callable to invoke for each extension.

      - args – Variable arguments to pass to func()

      - kwds – Keyword arguments to pass to func()

    Returns:

      List of values returned from func()

  map_method(names: Sequence[str], method_name: str, *args: Any, **kwds: Any) → Any

    Iterate over the extensions invoking each one’s object method called method_name for any where the name is in the given list of names.

    This is equivalent of using `map()` with func set to lambda x: x.obj.method_name() while being more convenient.

    Exceptions raised from within the called method are propagated up and processing stopped if self.propagate_map_exceptions is True, otherwise they are logged and ignored.

    Added in version 0.12.

    Parameters:

      - names – List or set of name(s) of extension(s) to invoke.

      - method_name – The extension method name to call for each extension.

      - args – Variable arguments to pass to method

      - kwds – Keyword arguments to pass to method

    Returns:

      List of values returned from methods

## ExtensionManager

class stevedore.extension.ExtensionManager(namespace: str, invoke_on_load: bool = False, invoke_args: tuple[~typing.Any, ...] | None=None, invoke_kwds: dict[str, ~typing.Any] | None=None, propagate_map_exceptions: bool = False, on_load_failure_callback: OnLoadFailureCallbackT[T] | None = None, verify_requirements: bool | None = None, *, conflict_resolver: ConflictResolverT[T] = <function ignore_conflicts>)

  Bases: `Generic`[`T`]

  Base class for all of the other managers.

  Parameters:

    - namespace – The namespace for the entry points.

    - invoke_on_load – Boolean controlling whether to invoke the object returned by the entry point after the driver is loaded.

    - invoke_args – Positional arguments to pass when invoking the object returned by the entry point. Only used if invoke_on_load is True.

    - invoke_kwds – Named arguments to pass when invoking the object returned by the entry point. Only used if invoke_on_load is True.

    - propagate_map_exceptions – Boolean controlling whether exceptions are propagated up through the map call or whether they are logged and then ignored

    - on_load_failure_callback – Callback function that will be called when an entrypoint can not be loaded. The arguments that will be provided when this is called (when an entrypoint fails to load) are (manager, entrypoint, exception)

    - verify_requirements – DEPRECATED This is a no-op and will be removed in a future version.

    - conflict_resolver – A callable that determines what to do in the event that there are multiple entrypoints in the same group with the same name. This is only used if retrieving entrypoint by name.

  __annotate_func__()

    The type of the None singleton.

  __contains__(name: str) → bool

    Return true if name is in list of enabled extensions.

  __getitem__(name: str) → Extension[T]

    Return the named extension.

    Accessing an ExtensionManager as a dictionary (`em['name']`) produces the `Extension` instance with the specified name.

  __init__(namespace: str, invoke_on_load: bool = False, invoke_args: tuple[~typing.Any, ...] | None=None, invoke_kwds: dict[str, ~typing.Any] | None=None, propagate_map_exceptions: bool = False, on_load_failure_callback: OnLoadFailureCallbackT[T] | None = None, verify_requirements: bool | None = None, *, conflict_resolver: ConflictResolverT[T] = <function ignore_conflicts>) → None
  __iter__() → Iterator[Extension[T]]

    Produce iterator for the manager.

    Iterating over an ExtensionManager produces the `Extension` instances in the order they would be invoked.

  __weakref__

    list of weak references to the object

  entry_points_names() → list[str]

    Return the list of entry points names for this namespace.

  items() → ItemsView[str, Extension[T]]

    Return an iterator of tuples of the form (name, extension).

    This is analogous to the Mapping.items() method.

  list_entry_points() → list[EntryPoint]

    Return the list of entry points for this namespace.

    The entry points are not actually loaded, their list is just read and returned.

  classmethod make_test_instance(extensions: list[~stevedore.extension.Extension[~stevedore.extension.T]], namespace: str = 'TESTING', propagate_map_exceptions: bool = False, on_load_failure_callback: OnLoadFailureCallbackT[T] | None = None, verify_requirements: bool | None = None, *, conflict_resolver: ConflictResolverT[T] = <function ignore_conflicts>) → Self

    Construct a test ExtensionManager

    Test instances are passed a list of extensions to work from rather than loading them from entry points.

    Parameters:

      - extensions – Pre-configured Extension instances to use

      - namespace – The namespace for the manager; used only for identification since the extensions are passed in.

      - propagate_map_exceptions – When calling map, controls whether exceptions are propagated up through the map call or whether they are logged and then ignored

      - on_load_failure_callback – Callback function that will be called when an entrypoint can not be loaded. The arguments that will be provided when this is called (when an entrypoint fails to load) are (manager, entrypoint, exception)

      - verify_requirements – DEPRECATED This is a no-op and will be removed in a future version.

      - conflict_resolver – A callable that determines what to do in the event that there are multiple entrypoints in the same group with the same name. This is only used if retrieving entrypoint by name.

    Returns:

      The manager instance, initialized for testing

  map(func: ~collections.abc.Callable[[~typing.Concatenate[~stevedore.extension.Extension[~stevedore.extension.T], ~P]], ~stevedore.extension.U], *args: ~typing.~P, **kwds: ~typing.~P) → list[U]

    Iterate over the extensions invoking func() for each.

    The signature for func() should be:

        def func(ext, *args, **kwds):
            pass

    The first argument to func(), ‘ext’, is the `Extension` instance.

    Exceptions raised from within func() are propagated up and processing stopped if self.propagate_map_exceptions is True, otherwise they are logged and ignored.

    Parameters:

      - func – Callable to invoke for each extension.

      - args – Variable arguments to pass to func()

      - kwds – Keyword arguments to pass to func()

    Returns:

      List of values returned from func()

  map_method(method_name: str, *args: Any, **kwds: Any) → Any

    Iterate over the extensions invoking a method by name.

    This is equivalent of using `map()` with func set to lambda x: x.obj.method_name() while being more convenient.

    Exceptions raised from within the called method are propagated up and processing stopped if self.propagate_map_exceptions is True, otherwise they are logged and ignored.

    Added in version 0.12.

    Parameters:

      - method_name – The extension method name to call for each extension.

      - args – Variable arguments to pass to method

      - kwds – Keyword arguments to pass to method

    Returns:

      List of values returned from methods

  names() → list[str]

    Returns the names of the discovered extensions

## Extension

class stevedore.extension.Extension(name: str, entry_point: EntryPoint, plugin: type[T], obj: T | None)

  Bases: `Generic`[`T`]

  Book-keeping object for tracking extensions.

  The arguments passed to the constructor are saved as attributes of the instance using the same names, and can be accessed by the callables passed to `map()` or when iterating over an `ExtensionManager` directly.

  Parameters:

    - name – The entry point name.

    - entry_point – The EntryPoint instance returned by `entrypoints`.

    - plugin – The value returned by entry_point.load()

    - obj – The object returned by `plugin(*args, **kwds)` if the manager invoked the extension on load.

  property attr: str

    The attribute of the module to be loaded.

  property entry_point_target: str

    The module and attribute referenced by this extension’s entry_point.

    Returns:

      A string representation of the target of the entry point in ‘dotted.module:object’ format.

  property module_name: str

    The name of the module from which the entry point is loaded.

    Returns:

      A string in ‘dotted.module’ format.

## TestExtensionManager

class stevedore.tests.manager.TestExtensionManager(extensions, namespace='test', invoke_on_load=False, invoke_args=(), invoke_kwds={})

  Bases: `ExtensionManager`[`T`]

  ExtensionManager that is explicitly initialized for tests.

  Deprecated since version 0.13: Use the `make_test_instance()` class method of the class being replaced by the test instance instead of using this class directly.

  Parameters:

    - extensions – Pre-configured Extension instances to use instead of loading them from entry points.

    - namespace – The namespace for the entry points.

    - invoke_on_load – Boolean controlling whether to invoke the object returned by the entry point after the driver is loaded.

    - invoke_args – Positional arguments to pass when invoking the object returned by the entry point. Only used if invoke_on_load is True.

    - invoke_kwds – Named arguments to pass when invoking the object returned by the entry point. Only used if invoke_on_load is True.

  __init__(extensions, namespace='test', invoke_on_load=False, invoke_args=(), invoke_kwds={})

this page last updated: 2026-07-13 22:23:38

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.

found an error? report a bug