Public API¶
Create virtual environments using pyproject.toml metadata.
Exceptions:
Base |
|
|
|
|
|
Functions:
|
Create a “devenv”. |
-
mkdevenv(project_dir, venv_dir='venv', *, verbosity=1, upgrade=False, python=None)[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 torepo_dir. Default'venv'.verbosity (
int) – The verbosity of the function.0= quiet,2= very verbose. Default1.upgrade (
bool) – Whether to upgrade all specified packages to the newest available version. DefaultFalse.python (
Optional[str]) – Path to the Python interpreter to use (e.g. a version of CPython, PyPy, RustPython, GraalPython). DefaultNone.
- Return type
Changed in version 0.2.0: Added
pythonkeyword argument.
-
exception
BaseInstallError[source]¶ Bases:
RuntimeErrorBase
Exceptionto indicate an error occurred when installing packages.
-
exception
InstallFromFileError(filename)[source]¶ Bases:
pyproject_devenv.BaseInstallErrorExceptionto indicate an error occurred when installing packages from a requirements file.
-
exception
InstallError(*requirements)[source]¶ Bases:
pyproject_devenv.BaseInstallErrorExceptionto indicate an error occurred when installing packages.- Parameters
*requirements (
Union[str,Requirement]) – The requirements being installed.
pyproject_devenv.config¶
Read the pyproject-devenv config from pyproject.toml.
Classes:
|
|
|
|
|
Parser for a reduced subset of the PEP 621 metadata from |
Functions:
|
Load the |
-
load_toml(filename)[source]¶ Load the
pyproject-devenvconfiguration mapping from the given TOML file.- Parameters
- Return type
-
class
ConfigTracebackHandler[source]¶ Bases:
pyproject_parser.cli.ConfigTracebackHandlerconsolekit.tracebacks.TracebackHandlerwhich handlesdom_toml.parser.BadConfigErrorandBaseInstallError.
-
typeddict
ConfigDict[source]¶ Bases:
TypedDicttyping.TypedDictrepresenting the configuration returned byload_toml().- Required Keys
name (
str)dependencies (
List[ComparableRequirement])optional_dependencies (
Dict[str,List[ComparableRequirement]])build_dependencies (
Optional[List[ComparableRequirement]])
-
class
PEP621Parser[source]¶ Bases:
PEP621ParserParser for a reduced subset of the PEP 621 metadata from
pyproject.toml.-
keys= ['name', 'dependencies', 'optional-dependencies']¶ -
The list of keys parsed from
pyproject.toml
-
parse(config, set_defaults=False)[source]¶ Parse the TOML configuration.
- Parameters
set_defaults (
bool) – IfTrue, the values inself.defaultsandself.factorieswill be set as defaults for the returned mapping. DefaultFalse.
- Return type
-