venv_management.driver module

The virtualenvwrapper driver interface and factories.

Summary

Exceptions:

DriverExtensionError

Indicates that an error specific to a driver extension occurred.

Classes:

Driver

Defines the interface for a virtualenvwrapper-equivalent driver.

Functions:

create_driver

Create a driver

driver

Obtain a Driver instance.

driver_names

A list of available driver extensions.

Reference

class venv_management.driver.Driver(name)[source]

Bases: venv_management.extension.Extension

Defines the interface for a virtualenvwrapper-equivalent driver.

abstract list_virtual_envs() List[str][source]

The virtual environments available to this package.

Returns

A list of virtual environment names which can be manipulated by this package.

abstract make_virtual_env(name, *, python=None, project_path=None, packages=None, requirements_file=None, system_site_packages=False, pip=True, setuptools=True, wheel=True)[source]

Make a virtual env.

Parameters
  • name – The name of the virtual environment.

  • project_path – An optional path to a project which will be associated with the new virtual environment.

  • packages – An optional sequence of package names for packages to be installed.

  • requirements_file – An optional path to a requirements file to be installed.

  • python – The target interpreter for which to create a virtual environment, either the name of the executable, or full path.

  • system_site_packages – If True, give access to the system site packages.

  • pip – If True, or ‘latest’ the latest pip will be installed. If False, pip will not be installed. If ‘bundled’, the bundled version will be installed. If a specific version string is given, that version will be installed.

  • setuptools – If True, or ‘latest’ the latest pip will be installed. If False, pip will not be installed. If ‘bundled’, the bundled version will be installed. If a specific version string is given, that version will be installed.

  • wheel – If True, or ‘latest’ the latest pip will be installed. If False, pip will not be installed. If ‘bundled’, the bundled version will be installed. If a specific version string is given, that version will be installed.

Returns

The Path to the root of the virtualenv, or None if the path could not be determined.

Raises
abstract remove_virtual_env(name: str)[source]

Remove a virtual environment.

Parameters

name – The name of the virtual environment to be removed.

Raises

ValueError – If the name is empty.

abstract resolve_virtual_env(name: str) pathlib.Path[source]

Obtain a path to the virtual environment directory.

Parameters

name – The name of the virtual environment.

Returns

The path of the named virtual environment.

Raises

ValueError – If there is no virtual environment with the supplied name.

exception venv_management.driver.DriverExtensionError[source]

Bases: venv_management.extension.ExtensionError

Indicates that an error specific to a driver extension occurred.

venv_management.driver.create_driver(driver_name) venv_management.driver.Driver[source]

Create a driver

Parameters

driver_name – The name of the driver to create.

Returns

A Driver instance.

Raises

ImplementationNotFoundError – If a driver could be created but the driver could not find a working virtualenvwrapper (or equivalent) implementation.

venv_management.driver.driver_names() List[venv_management.driver.Driver][source]

A list of available driver extensions.

There is no guarantee that the listed drivers are backed by functioning virtualenvwrapper implementations.

venv_management.driver.driver() venv_management.driver.Driver[source]

Obtain a Driver instance.

Returns

A Driver corresponding to an available virtualenvwrapper implementation.

Raises

ImplementationNotFound – If no suitable virtualenvwrapper installation was found