prometa.python package
Submodules
prometa.python.common module
All things specific to Python (pyproject.toml, PyPI, etc.)
prometa.python.venv module
Virtual environment functions.
- class prometa.python.venv.VirtualEnvironment(update_pip=False, inherit=False)[source]
Bases:
ExitStack
Context manager for temporary Python virtual environments.
- __init__(update_pip=False, inherit=False)[source]
- Parameters:
update_pip – If True, update pip in the virtual environment.
inherit – If True, create a .pth file to inherit packages from the parent environment.
- run_cmd(cmd, **kwargs)[source]
Run a command with subprocess.
- Parameters:
cmd – The command to run, as a list.
**kwargs – Keyword arguments passed through to subprocess.run.
- Returns:
The return value of subprocess.run.
- run_cmd_in_venv(cmd, **kwargs)[source]
Run a command in the virtuel environment. This will pass the virtual environment’s environment variables to the subprocess command.
- run_pip_in_venv(args, **kwargs)[source]
Run a pip command in the virtual environment. This is a wrapper around run_python_in_venv().
- Parameters:
args – The arguments to pass to pip.
**kwargs – Keyword arguments passed through to run_python_in_venv().
- Returns:
The return value of run_python_in_venv().
- run_python_in_venv(args, **kwargs)[source]
Run a Python command in the virtual environment. This will only work within this class’ context.
- Parameters:
args – The arguments to pass to the Python interpretter.
**kwargs – Keyword arguments passed through to subprocess.run.
- Returns:
The return value of subprocess.run.
Module contents
Package stub.