VirtualEnv¶
- class neophile.virtualenv.VirtualEnv(path: Path)¶
Bases:
object
Manage virtual environments.
Python dependency updates using
make update
have to be done inside a virtual environment because they may attempt to install packages with pip. This class manages creation and execution of commands inside a virtual environment.- Parameters
path (
pathlib.Path
) – Path to where to create the virtual environment. If that directory already exists, it will be used as an existing virtual environment instead of creating a new one.
Methods Summary
create
()Create the virtualenv if it does not already exist.
run
(command, **kwargs)Run a command inside the virtualenv.
Methods Documentation
- create() None ¶
Create the virtualenv if it does not already exist.
- Raises
subprocess.CalledProcessError – On failure to install the wheel package or if the command given sets the
check
argument.
- run(command: Sequence[str], **kwargs: Any) CompletedProcess ¶
Run a command inside the virtualenv.
Sets up the virtualenv if necessary and then runs the command given.
- Parameters
command (Sequence[
str
]) – The command to run.**kwargs (
typing.Any
) – The arguments, which except for theenv
parameter if any will be passed as-is tosubprocess.run()
.
- Returns
result – The return value of
subprocess.run()
.- Return type
- Raises
subprocess.CalledProcessError – On failure to install the wheel package or if the command given sets the
check
argument.