Is there a way to set arbitrary variables within tox.ini?
An example would be a project name that might be used in a variety of ways. With a rather complex tox.ini, I find myself copy and pasting all over where I should just need to set a variable at the top.
For reference, an example tox.ini:
[tox]
envlist = clean, py{27,35,py}, license, style
skipsdist = True
skip_missing_interpreters = True
sitepackages = False[testenv:clean]
deps = coverage
skip_install = true
commands =hash -rfind {toxinidir} -name '*.pyc' -deletefind {toxinidir} -name '__pycache__' -deletecoverage eraserm -Rf {toxinidir}/docs/_build {toxinidir}/docs/coverage {toxinidir}/docs/reports[testenv]
passenv = *
whitelist_externals = *
install_command = {envpython} -m pip install -q --process-dependency-links {opts} {packages}
envdir = {env:WORKON_HOME}/tox-<project_name>/{envname}
sitepackages = False
recreate = True
commands =# hash -rpy{27,35,py}: {envpython} -m pytest --cov-append --cov=<project_name> --html=docs/reports/{envname}-report.html {posargs}smoke: {envpython} -m pytest -m smoke --cov-append --cov=<project_name> --html=docs/reports/{envname}-report.html {posargs}unit: {envpython} -m pytest -m unit --cov-append --cov=<project_name> --html=docs/reports/{envname}-report.html {posargs}integration: {envpython} -m pytest -m integration --long-running --cov-append --cov=<project_name> --html=docs/reports/{envname}-report.html {posargs}requirements: {envpython} -m pytest --cov-append --cov=<project_name> --html=docs/reports/{envname}-report.html {posargs}license: {envpython} -m pytest -m license --license --cov-append --html=docs/reports/{envname}-report.html {posargs}py{27,35,py}-smoke: {envpython} -m pytest -m smoke --cov-append --cov=<project_name> --html=docs/reports/{envname}-report.html {posargs}py{27,35,py}-unit: {envpython} -m pytest -m unit --cov-append --cov=<project_name> --html=docs/reports/{envname}-report.html {posargs}py{27,35,py}-integration: {envpython} -m pytest -m integration --long-running --cov-append --cov=<project_name> --html=docs/reports/{envname}-report.html {posargs}py{27,35,py}-requirements: {envpython} -m pytest --cov-append --cov=<project_name> --html=docs/reports/{envname}-report.html {posargs}py{27,35,py}-license: {envpython} -m pytest -m license --cov-append --html=docs/reports/{envname}-report.html {posargs}
deps =--editable=file:///{toxinidir}[tests]--editable=file:///{toxinidir}py{27,35,py}-requirements: -r{toxinidir}/requirements.txt[testenv:coverage-report]
deps = coverage
skip_install = true
whitelist_externals = *
commands =hash -rcoverage combinecoverage report -m[testenv:docs]
sitepackages = False
whitelist_externals = *
recreate = True
deps = --editable=file:///{toxinidir}[docs]
commands =hash -rcoverage html --directory=docs/coveragecoverage html{envpython} setup.py build_sphinx[testenv:style]
whitelist_externals = *
sitepackages = False
recreate = True
commands =py.test -q --flake8 <project_name>/ --html=docs/reports/{envname}-report.html {posargs}[testenv:vagrant]
passenv = *
whitelist_externals = *
sitepackages = False
recreate = False
skip_install = true
changedir = {toxinidir}/provision/vagrant
commands =hash -rvagrant destroy --forcevagrant up