summaryrefslogtreecommitdiff
path: root/doc/example/devenv.txt
blob: d9444875e845c3660be29026964956abf47d8c4f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62

Development environment
=======================

Tox can be used to prepare development virtual environment for local projects.
This feature can be useful in order to preserve environment across team members
working on same project. It can be also used by deployment tools to prepare
proper environments.

*devenv* would be created at specific directory, not within ``.tox`` directory
as other test environments. Other than that, configuration for this environment
is very similar to other tox envs.


Configuration
-------------

Firstly, you need to prepare configuration for your development environment. In
order to do that, we must define proper section at ``tox.ini`` file and tell at
what directory environment should be created. Moreover, we need to specify
python version that should be picked::

    [testenv:devenv]
    envdir = devenv
    basepython = python2.7


Actually, you can configure a lot more, those are the only required settings.
In example you can add ``deps`` and ``commands`` settings.



Creating development environment
--------------------------------

Once ``devenv`` section is defined we can instrument tox to create our
environment::

    tox -e devenv

This will create an environment at path specified by ``envdir`` under
``[testenv:devenv]`` section.



Full configuration example
--------------------------

Let's say we want our development environment sit at ``devenv``. We create this
directory manually and put ``requirements.txt`` file there. We want to work on
Python 2.7.

Here is example configuration for that::

    [testenv:devenv]
    envdir = devenv
    changedir = devenv
    basepython = python2.7
    commands =
        pip install -r requirements.txt