New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ignore_basepython_conflict option is not in effect in tox4 #2754
Comments
As an aside, that option really should have been removed in tox 4.x. It was an escape hatch intended to avoid introducing a backwards incompatible change, even though the backwards-incompatible behaviour was the correct one. Personally, I'd be in favour of removing this option immediately in 4.0.x and forcing the |
I'm afraid I have to disagree. The breaking change with 4.x is to change |
You should remove basepython = python3 to get python version from sys.executable. Also python3 satisfies python3.12 |
You got those backwards, I assume? In 3.x, if you set (You should still be able to set |
This only applies if your host uses Edit Actually, no, |
The following is intended to be a correct tox configuration: [tox] min_version = 4.1 env_list = py{38,39,310,311},docs [testenv] base_python = python3 [testenv:docs] commands = sphinx-build ... The goal of this is to use 'python3' (i.e. the value of '[testenv] base_python') for all environments except those with specific 'pyXX' factors in them. This helps eliminate issues where environments that do not specify a 'pyXX' factor run with different Python versions in different environments. An earlier bug, tox-dev#477 [1], prevented us from doing this. Due to tox-dev#477, the interpreter version indicated by '[testenv] base_python' (or rather '[testenv] basepython' - the underscore-separated variant was only introduced in tox 4) would override the value indicated by the 'pyXX' factor. This was resolved with a PR, tox-dev#841 [2], which started warning users if they were unintentionally running against the wrong interpreter and introduced the 'ignore_basepython_conflict' value to opt into the correct behavior. Unfortunately, this has been broken in the move to tox 4. Currently, running with the above configuration will result in 'python3' being used for every environment. This is clearly incorrect. This issue stems from an errant bit of logic. When comparing interpreter versions as part of the '_validate_base_python', we ignore various attributes if they are unset on either '[testenv] base_python' or the 'pyXX' factor. This allows e.g. 'python3' to match 'python3.8', which isn't correct. Correct this by insisting on matching on all attributes that are set on the factor. [1] tox-dev#477 [2] tox-dev#841 Signed-off-by: Stephen Finucane <stephen@that.guru> Closes: tox-dev#2754
The following is intended to be a correct tox configuration: [tox] min_version = 4.1 env_list = py{38,39,310,311},docs [testenv] base_python = python3.8 [testenv:docs] commands = sphinx-build ... The goal of this is to use 'python3.8' (i.e. the value of '[testenv] base_python') for all environments except those with specific 'pyXX' factors in them. This helps eliminate issues where environments that do not specify a 'pyXX' factor run with different Python versions in different environments. An earlier bug, tox-dev#477 [1], prevented us from doing this. Due to tox-dev#477, the interpreter version indicated by '[testenv] base_python' (or rather '[testenv] basepython' - the underscore-separated variant was only introduced in tox 4) would override the value indicated by the 'pyXX' factor. This was resolved with a PR, tox-dev#841 [2], which started warning users if they were unintentionally running against the wrong interpreter and introduced the 'ignore_basepython_conflict' value to opt into the correct behavior. Unfortunately, this has been partially broken in the move to tox 4. While the above configuration still works, the following no longer does: [tox] min_version = 4.1 env_list = py{38,39,310,311},docs [testenv] base_python = python3 [testenv:docs] commands = sphinx-build ... This configuration was common back during the move from Python 2 to Python 3. It ensured that 'python3' was used for all testenvs that did not request an explicit Python version via a factor or their own 'base_python' version. While it's no longer necessary, it is still quite common. Currently, running with this configuration will result in 'python3' being used for every environment, rather than e.g. 'python3.8' for a testenv with the 'py38' factor. This is clearly incorrect. This issue stems from an errant bit of logic. When comparing interpreter versions as part of the '_validate_base_python', we ignore various attributes if they are unset on either '[testenv] base_python' or the 'pyXX' factor. This allows e.g. 'python3' to match 'python3.8', since the minor version is unset for the '[testenv] base_python' value, 'python3'. The fix is simple: while we can ignore unset attributes for factor-derived versions (to allow a 'py3' factor to work with e.g. 'base_python = python3.8'), we should insist on them for 'base_python'-derived versions. [1] tox-dev#477 [2] tox-dev#841 Signed-off-by: Stephen Finucane <stephen@that.guru> Closes: tox-dev#2754
Ok, I've changed my mind. I thought to leave ignore_basepython_conflict as a stopgap for people to migrate it, however, if we're considering it a feature to create confusing configurations, I'm now inclined to just remove it and set it to always False. ignore_basepython_conflict was not meant to set default pythons that can be then ignored by some envs. |
I've also changed my mind. I still think that this option should exist, since I think there is value in being able to define a default Put another way, with #2824, we should now be able to once again specify |
* use min version 4.2.5, for fixes [1][2][3] * passenv fixed as space-separated list is not allowed anymore * dock target uses requirements from requirements.txt as well as doc/requirements.txt * skipsdist is not supported * whitelist_externals has been removed in favour of allowlist_externals * reno was added to doc/requirements.txt to fix the releasenotes target * update setup.cfg to install aodh from tarball in the requirements The tarball wasn't being installed when specified in tox.ini, and the [extras] section in setup.cfg needed updating to support installing from a URL [1] tox-dev/tox#2754 [2] tox-dev/tox#2824 [3] tox-dev/tox#2828 Change-Id: I4122d0d05f297f864318e80392e6c77fb2e9fdcf
* Update python-aodhclient from branch 'master' to 02176deb25b3a8f1bc02eb3d70f0a50ce22f02f7 - Make tox.ini tox 4.0 compatible * use min version 4.2.5, for fixes [1][2][3] * passenv fixed as space-separated list is not allowed anymore * dock target uses requirements from requirements.txt as well as doc/requirements.txt * skipsdist is not supported * whitelist_externals has been removed in favour of allowlist_externals * reno was added to doc/requirements.txt to fix the releasenotes target * update setup.cfg to install aodh from tarball in the requirements The tarball wasn't being installed when specified in tox.ini, and the [extras] section in setup.cfg needed updating to support installing from a URL [1] tox-dev/tox#2754 [2] tox-dev/tox#2824 [3] tox-dev/tox#2828 Change-Id: I4122d0d05f297f864318e80392e6c77fb2e9fdcf
It's the cause of many tox 4 bugs and the 'ignore_basepython_conflict' option is likely to go away at some point [1]. [1] tox-dev/tox#2754 (comment) Signed-off-by: Stephen Finucane <stephen@that.guru>
* Update aodh from branch 'master' to 84d59a198257ea6f3b839ca5d96cbaa74f2f3b76 - Make tox.ini tox 4.0 compatible * use min version 4.2.5, for fixes [1][2][3] * passenv fixed as space-separated list is not allowed anymore * doc target uses requirements.txt as well as docs/requirements.txt * skipsdist is not supported * Add usedevelop = False so that aodh-api gets installed Update setup.cfg: [files] -> [options] [1] tox-dev/tox#2754 [2] tox-dev/tox#2824 [3] tox-dev/tox#2828 Change-Id: I2422dc17e6c73ef346de80e57cdf61ef5d271d69
* use min version 4.2.5, for fixes [1][2][3] * passenv fixed as space-separated list is not allowed anymore * doc target uses requirements.txt as well as docs/requirements.txt * skipsdist is not supported * Add usedevelop = False so that aodh-api gets installed Update setup.cfg: [files] -> [options] [1] tox-dev/tox#2754 [2] tox-dev/tox#2824 [3] tox-dev/tox#2828 Change-Id: I2422dc17e6c73ef346de80e57cdf61ef5d271d69
Issue
Seems ignore_basepython_conflict option is not in effect in tox4. Setting it up to True or False doesn't change anything if envlist contains py310 but python3 points to python3.8.
Environment
Provide at least:
pip list
of the host Python wheretox
is installed:Output of running tox
Provide the output of
tox -rvv
:Minimal example
tox.ini:
Pythons:
The text was updated successfully, but these errors were encountered: