Usage

venv_tools contains two context managers, venv_tools.Venv and venv_tools.TemporaryVenv, which are designed to work together:

with TemporaryVenv() as env_dir, Venv(env_dir):
    call(["pip", "install", "-r", "requirements.txt"])
    call(["python", "-m", "profile", "project"])

Or, if you already have a venv:

with Venv(env_dir):
    call(["pip", "install", "-r", "requirements.txt"])
    call(["python", "-m", "profile", "project"])

Because venv_tools wraps around the venv.EnvBuilder API in Python 3.3 and above, it’s possible to use more featureful subclasses, such as the example given here.