Pewarta Proxy

📋 Server Request & Proxy Logs

Loading active proxy settings...
Developed by Khairul Adha (adhexa.id)
Mengambil log server...

⚙️ Pengaturan Proxy Target

Skip to content

Commit 4e43164

Browse files
EliahKaganclaude
andcommitted
build(tox): write base_python fallbacks as comma-separated lists
The `ruff`, `format`, `mypy`, `html`, and `misc` environments are each meant to run once, on the first available interpreter in a preference order: Python 3.9 first, then 3.10, 3.11, 3.12, and 3.8. They wrote that as `base_python = py{39,310,311,312,38}`, a form introduced in 62c024e (gitpython-developers#1693). tox expands braces in generative environment lists and section names, such as `env_list = py{38,...}` and `[testenv:py{38,39,310}]` in this file, and in factor conditions, but not in the values of settings like `base_python`. There, it just splits on commas, giving the five specs `py{39`, `310`, `311`, `312`, and `38}`. The first and last are not valid interpreter specs, so 3.9 and 3.8 were never candidates. The bare `310`, `311`, and `312` are accepted as version specs, so the environments still ran if 3.10, 3.11, or 3.12 was found. If none was, the environment did not run: with tox 4.11.3 running on 3.13 and only 3.9 on `PATH`, it reported "skipped because could not find python interpreter with spec(s): py{39, 310, 311, 312, 38}". Since tox 4.56.0 changed the default of `skip_missing_interpreters` to false, current tox fails it instead. Write each list as `py39, py310, py311, py312, py313, py314, py315`, the documented form for several `base_python` values, of which the first one found is used. This writes the intended order, except that 3.8 is left out, and adds the newer versions at the end. Current virtualenv does not try them in that order, as described below. 62c024e listed as fallbacks all the Python versions the project supported, but the lists were not extended when da58f39 (gitpython-developers#2196) added 3.13, 3.14, and 3.15 to `env_list`. So on a system with only 3.13 or later, these environments could not run at all. With only 3.13, 3.14, and 3.15 available, a probe with `py39, py310, py311, py312` was skipped with tox 4.23.2 and virtualenv 20.28.1 and failed with tox 4.67.1 and virtualenv 21.14.13, while the full list ran on 3.13 with both. The brace form never selected 3.8, so leaving it out takes away nothing that worked, and listing it would now cause failures. Since virtualenv 21.5.0, virtualenv cannot create Python 3.8 environments. tox 4.56.0 and later work around that by bootstrapping an older virtualenv, but only when the installed virtualenv can create none of the `base_python` candidates, which is not the case for a list that also names newer versions. Current virtualenv also tries the first listed interpreter last, as described below, so 3.8 would be tried before 3.9. With tox 4.67.1 and virtualenv 21.14.13 and only 3.8 and 3.9 available, a probe with `py39, py310, py311, py312, py38` accepted 3.8 and then failed with "could not find python interpreter matching any of the specs". With `py39, py310, py311, py312`, it ran on 3.9. Even where 3.8 environments can be created, `mypy` and `html` would not work as intended on 3.8. The `test` extra installs mypy only on 3.9 and later, so the `mypy` environment would not have the `mypy` command it runs, and `ignore_outcome` would turn that failure into a warning. The `doc` group's Sphinx requirement also applies only on 3.9 and later, so `html` would build with whatever Sphinx version the other documentation dependencies happened to pull in. Checked with a minimal tox project whose only environment prints its interpreter's version, with Python 3.9 and 3.12 on `PATH` and tox itself running on 3.13. | Tooling | Brace form | Comma form | |----------------------------------|------------|------------| | tox 4.11.3, virtualenv 20.24.5 | 3.12 | 3.9 | | tox 4.23.2, virtualenv 20.28.1 | 3.12 | 3.9 | `tox config` shows the intended entries for each environment. With tox 4.23.2 and virtualenv 20.28.1, `tox -e ruff` and `tox -e format` with this `tox.ini` ran on Python 3.9.6 and passed. With tox 4.67.1, each of the five environments also ran and passed on each of Python 3.13.17, 3.14.9, and 3.15.1, selected with `-x testenv:<name>.base_python=py313` and so on. `html` reports no Sphinx warnings on 3.13, but 13 on each of 3.14 and 3.15, all about `__annotate_func__`, which Python 3.14 adds to the `__dict__` of classes with annotations. The build used Sphinx 7.4.7, as the `doc` group requires Sphinx below 8. CI's documentation build on 3.14 reports the same 13 warnings. Current virtualenv does not keep this order. tox passes the `base_python` list to virtualenv in `VIRTUALENV_PYTHON`, and since virtualenv 20.29, when that variable is set, virtualenv moves the first spec to the end of the list. That change, pypa/virtualenv@bc7a91a5 (pypa/virtualenv#2821), was meant to let a `--python` option take precedence over a single interpreter set in the variable. So with tox 4.67.1 and virtualenv 21.14.13, the first listed interpreter is tried last: a probe with `py39, py312, py311` ran on 3.12, and one with `py312, py39` ran on 3.9. This is a problem in how tox and virtualenv interact, not in this configuration. With current versions, these environments are tried on 3.9 only if none of 3.10 through 3.15 is found. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 5afb6da commit 4e43164

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

‎tox.ini‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ commands = python -I -c "import git; from git import _backend; assert _backend.n
1919

2020
[testenv:ruff]
2121
description = Lint with Ruff
22-
base_python = py{39,310,311,312,38}
22+
base_python = py39, py310, py311, py312, py313, py314, py315
2323
skip_install = true
2424
deps = ruff
2525
set_env =
@@ -37,7 +37,7 @@ commands = python test/run-local.py {posargs:--backend-report=.cache/gix-coverag
3737

3838
[testenv:format]
3939
description = Check formatting with Ruff
40-
base_python = py{39,310,311,312,38}
40+
base_python = py39, py310, py311, py312, py313, py314, py315
4141
skip_install = true
4242
deps = ruff
4343
set_env =
@@ -46,15 +46,15 @@ commands = ruff format --check .
4646

4747
[testenv:mypy]
4848
description = Typecheck with mypy
49-
base_python = py{39,310,311,312,38}
49+
base_python = py39, py310, py311, py312, py313, py314, py315
5050
set_env =
5151
MYPY_FORCE_COLOR = 1
5252
commands = mypy
5353
ignore_outcome = true
5454

5555
[testenv:html]
5656
description = Build HTML documentation
57-
base_python = py{39,310,311,312,38}
57+
base_python = py39, py310, py311, py312, py313, py314, py315
5858
extras =
5959
dependency_groups = doc
6060
allowlist_externals = make
@@ -64,7 +64,7 @@ commands =
6464

6565
[testenv:misc]
6666
description = Run other checks via pre-commit
67-
base_python = py{39,310,311,312,38}
67+
base_python = py39, py310, py311, py312, py313, py314, py315
6868
skip_install = true
6969
deps = pre-commit
7070
set_env =

0 commit comments

Comments
 (0)