Tox can be used for just preparing different virtual environments required by a project.
This feature can be used by deployment tools when preparing deployed project environments. It can also be used for setting up normalized project development environments and thus help reduce the risk of different team members using mismatched development environments.
Here are some examples illustrating how to set up a project’s development environment using tox. For illustration purposes, let us call the development environment devenv.
First, we prepare the tox configuration for our development environment by defining a [testenv:devenv] section in the project’s tox.ini configuration file:
[testenv:devenv]
envdir = devenv
basepython = python2.7
usedevelop = True
In it we state:
Actually, we can configure a lot more, and these are only the required settings. For example, we can add the following to our configuration, telling tox not to reuse commands or deps settings from the base [testenv] configuration:
commands =
deps =
Once the [testenv:devenv] configuration section has been defined, we create the actual development environment by running the following:
tox -e devenv
This creates the environment at the path specified by the environment’s envdir configuration value.
Let us say we want our project development environment to:
Here is an example configuration for the described scenario:
[testenv:devenv]
envdir = devenv
basepython = python2.7
usedevelop = True
deps = -rrequirements.txt