summaryrefslogtreecommitdiff
path: root/doc/drafts/tox_conda_notes_niccodemus.md
blob: a54189a6a2312a2306e25de5afb035e20ed1bb1e (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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
[tox]
envlist=py27,py35

[testenv]
commands= py.test --timeout=180 {posargs:tests}
deps=pytest>=2.3.5
    pytest-timeout

# USE CASE 1: plain conda, with deps on tox.ini
create_env_command = conda create --prefix {envdir} python={python_version}
install_command = conda install --prefix {envdir} {opts} {packages}
list_dependencies_command = conda list --prefix {envdir}

# deprecated: see tox_create_popen hook
linux:env_activate_command=source activate {envdir}
win:env_activate_command=activate.bat {envdir}

# USE CASE 2: plain conda, using requirements.txt
install_command = conda install --prefix {envdir} {opts} --file requirements.txt

# USE CASE 3: conda env
create_env_command = conda env create --prefix {envdir} python={python_version} --file environment.yml
install_command =

[testenv]
type=virtualenv
type=venv
type=conda
type=conda-reqs
type=conda-env

1. Create a new ``create_env_command`` option.
;2. Create a new ``env_activate_command`` option (also consider how to make that platform dependent).
2. New substitution variable: {python_version} ('3.4', '2.7', etc')
3. env type concept: different types change the default options.

1. tox_addoption can now add new "testenv" sections to tox.ini:

[virtualenv]
[conda]
[venv]

2. extend hooks:

    * tox_addoption
    * tox_configure
    for each requested env in config:
      tox_testenv_up_to_date(envmeta)
      tox_testenv_create(envmeta)
      tox_testenv_install_deps(envmeta, env)
      tox_runtest_pre(envmeta, env)
      tox_runtest(envmeta, env, popen)
      tox_runtest_post(envmeta, env)

3. separate virtualenv details from "VirtualEnv" class into a plugin.

[tox]
envlist={py27,py35}-{sdist,wheel,conda}

[package-sdist]
command = python setup.py sdist

[package-wheel]
command = python setup.py bdist_wheel

[package-conda]
command = conda build ./conda-recipe

[testenv:{sdist,wheel}]
commands = py.test

[testenv:conda]
packages = sdist,wheel
commands = py.test --conda-only

* tox_addoption
* tox_get_python_executable
* tox_configure
for each requested env in config:
  tox_testenv_create(envmeta)
  tox_testenv_install_deps(envmeta, env)
  tox_runtest_pre(envmeta, env)
  tox_runtest(envmeta, env, popen)
  tox_runtest_post(envmeta, env)