Tox: Ability to include/extend other inis in tox.ini

Created on 17 Sep 2016  路  7Comments  路  Source: tox-dev/tox

it would be useful to be able to share/reuse config (for example, a style toxenv) through some sort of include syntax in tox.ini.

e.g. in tox.ini:

[tox]
envlist = py27,py35,style
include = tox-style.ini

and style.ini:

[testenv:style]
....

That's almost definitely not the right syntax to use, but I think it gets the idea.

configuration discussion

Most helpful comment

I believe the idea above is to write a tox plugin which provides the defaults that you need. Installing a plugin which sets the reasonable defaults for your organization would remove most-if-not-all of the boilerplate of a configuration

I believe the tox_configure hook provides access to the tox configuration where you could add / remove / modify testenvs

All 7 comments

configuration inclusion and inheritance are both topics that are fundamentally hard to do well/right

as such we happily accept documentation showing how people would expect it to work
so that we or an outside volunteer can implement it based on those examples

(factors came in that way)

zc.buildout is also based on ini files and has a nice include/inherit and overwrite capability

I think the direction now is to move to pyproject.toml as such I vote for closing this issue as won't fix. It's unlikely anyone will pick this up, and would prefer to see an option based on the pyproject.toml. @obestwalter @asottile opinions?

closing, tox plugins should provide what was proposed

I think the direction now is to move to pyproject.toml as such I vote for closing this issue as won't fix. It's unlikely anyone will pick this up, and would prefer to see an option based on the pyproject.toml. @obestwalter @asottile opinions?

I'm not up to date here... How does a pyproject.toml eliminate the need for a .tox?

[tox]
minversion = 1.6
envlist =
    docs,
    docs-linkcheck
skipsdist = true

[testenv:docs]
deps = -rdocs/requirements.txt
commands =
    sphinx-build -b html -n -d {envtmpdir}/doctrees ./docs/ {toxinidir}/docs/_build/html

[testenv:docs-linkcheck]
deps = -rdocs/requirements.txt
commands = sphinx-build -b linkcheck -d {envtmpdir}/doctrees ./docs/ {toxinidir}/docs/_build/linkcheck

Much like @Aricg, I came to this issue looking for a better description of how to do this because my group is trying to avoid having to check in, install, and subsequently maintain hundreds of tox.ini files as part of the development in our project, or create Makefile or setup.py snippets that effectively template the tox.ini files.

@obestwalter, @asottile, @gaborbernat: can you please provide more details about how pyproject.toml can solve this deficiency?

flake8, for instance, has the ability to append a configuration on-demand, as noted here:

  --append-config=APPEND_CONFIG                                                                                                                                                                                                                                      Provide extra config files to parse in addition to the
                        files found by Flake8 by default. These files are the                                                                                                                                                                                        last ones read and so they take the highest precedence
                        when multiple files provide the same option.                                                                                                                                                                           --config=CONFIG       Path to the config file that will be the authoritative
                        config source. This will cause Flake8 to ignore all
                        other configuration files.

I believe the idea above is to write a tox plugin which provides the defaults that you need. Installing a plugin which sets the reasonable defaults for your organization would remove most-if-not-all of the boilerplate of a configuration

I believe the tox_configure hook provides access to the tox configuration where you could add / remove / modify testenvs

Was this page helpful?
0 / 5 - 0 ratings