venv_management.extension module

The plug-in extension mechanism.

Summary

Exceptions:

ExtensionError

Raised if there is an error in an extension.

Classes:

Extension

A generic extension point for plug-ins.

Functions:

create_extension

Create an instance of a named extension.

list_dirpaths

A mapping of extension names to extension package paths.

list_extensions

List the names of the extensions available in a given namespace.

Reference

exception venv_management.extension.ExtensionError[source]

Bases: Exception

Raised if there is an error in an extension.

venv_management.extension.list_extensions(namespace)[source]

List the names of the extensions available in a given namespace.

venv_management.extension.list_dirpaths(namespace)[source]

A mapping of extension names to extension package paths.

class venv_management.extension.Extension(name)[source]

Bases: abc.ABC

A generic extension point for plug-ins.

property kind: str

The kind of extension.

property name: str

The name of the extension.

The name used to create the extension.

classmethod dirpath()[source]

The directory path to the extension package.

property version

The version of the extension.

venv_management.extension.create_extension(kind, namespace, name, exception_type, *args, **kwargs) venv_management.extension.Extension[source]

Create an instance of a named extension.

Parameters
  • kind – The kind of extension to create.

  • namespace – The namespace within which the extension is a member.

  • name – The name of the extension.

  • exception_type – The type of exception to be raised if an extension could not be created.

  • *args – Positional arguments to forward to the extensions constructor.

  • **kwargs – Keyword arguments to forward to the extensions constructor.

Returns

An extension instance.

Raises

exception_type – If the requested extension could not be located.