Public API

Create virtual environments using pyproject.toml metadata.

Exceptions:

BaseInstallError

Base Exception to indicate an error occurred when installing packages.

InstallError(​*requirements)

Exception to indicate an error occurred when installing packages.

InstallFromFileError(​filename)

Exception to indicate an error occurred when installing packages from a requirements file.

Functions:

mkdevenv(​project_dir[, venv_dir, verbosity, …])

Create a “devenv”.

mkdevenv(project_dir, venv_dir='venv', *, verbosity=1, upgrade=False)[source]

Create a “devenv”.

Parameters
  • project_dir (Union[str, Path, PathLike]) – The root of the project to create the devenv for.

  • venv_dir (Union[str, Path, PathLike]) – The directory to create the devenv in, relative to repo_dir. Default 'venv'.

  • verbosity (int) – The verbosity of the function. 0 = quiet, 2 = very verbose. Default 1.

  • upgrade (bool) – Whether to upgrade all specified packages to the newest available version. Default False.

Return type

int

exception BaseInstallError[source]

Bases: RuntimeError

Base Exception to indicate an error occurred when installing packages.

exception InstallFromFileError(filename)[source]

Bases: pyproject_devenv.BaseInstallError

Exception to indicate an error occurred when installing packages from a requirements file.

Parameters

filename (Union[str, Path, PathLike]) – The file listing the packages to install.

filename

Type:    str

The file listing the packages to install.

exception InstallError(*requirements)[source]

Bases: pyproject_devenv.BaseInstallError

Exception to indicate an error occurred when installing packages.

Parameters

*requirements – The requirements being installed.

requirements

Type:    List[str]

The requirements being installed.

pyproject_devenv.config

Read the pyproject-devenv config from pyproject.toml.

Classes:

ConfigDict

typing.TypedDict representing the configuration returned by load_toml().

ConfigTracebackHandler(​)

consolekit.tracebacks.TracebackHandler which handles dom_toml.parser.BadConfigError and BaseInstallError.

PEP621Parser(​)

Parser for a reduced subset of the PEP 621 metadata from pyproject.toml.

Functions:

load_toml(​filename)

Load the pyproject-devenv configuration mapping from the given TOML file.

load_toml(filename)[source]

Load the pyproject-devenv configuration mapping from the given TOML file.

Parameters

filename (Union[str, Path, PathLike])

Return type

ConfigDict

class ConfigTracebackHandler[source]

Bases: pyproject_parser.cli.ConfigTracebackHandler

consolekit.tracebacks.TracebackHandler which handles dom_toml.parser.BadConfigError and BaseInstallError.

typeddict ConfigDict[source]

Bases: dict

typing.TypedDict representing the configuration returned by load_toml().

Required Keys
class PEP621Parser[source]

Bases: PEP621Parser

Parser for a reduced subset of the PEP 621 metadata from pyproject.toml.

keys = ['name', 'dependencies', 'optional-dependencies']

Type:    List[str]

The list of keys parsed from pyproject.toml

parse(config, set_defaults=False)[source]

Parse the TOML configuration.

Parameters
Return type

ProjectDict