feat(config): Allow ranges in envlist#3503
Conversation
Implements tox-dev#3502. Now it is possible to use ranges within the {} of an env specifier such as py3{10-13}. I chose to implement it as a pre-processing string replacement that just replaces the range with a literal enumeration of the range members. This is mainly to avoid more in-depth handling of these ranges when it coto generative environment lists. Also moves CircularChainError from `of_type` to `types` to avoid a circular import error. (kinda ironic :D)
40c9d2d to
310255e
Compare
|
When I run tox -e docs output(tox) ➜ tox git:(allow-ranges-in-env-list) ✗ tox -e docs
.pkg: _optional_hooks> python /home/martin/micromamba/envs/tox/lib/python3.13/site-packages/pyproject_api/_backend.py True hatchling.build
.pkg: get_requires_for_build_wheel> python /home/martin/micromamba/envs/tox/lib/python3.13/site-packages/pyproject_api/_backend.py True hatchling.build
.pkg: get_requires_for_build_editable> python /home/martin/micromamba/envs/tox/lib/python3.13/site-packages/pyproject_api/_backend.py True hatchling.build
.pkg: build_wheel> python /home/martin/micromamba/envs/tox/lib/python3.13/site-packages/pyproject_api/_backend.py True hatchling.build
docs: install_package> python -I -m pip install --force-reinstall --no-deps /home/martin/workspace/tox/.tox/.tmp/package/6/tox-4.24.3.dev4+g310255e0-py3-none-any.whl
docs: commands[0]> sphinx-build -d /home/martin/workspace/tox/.tox/docs/tmp/docs_tree docs /home/martin/workspace/tox/.tox/docs_out/html --color -b html -W
Running Sphinx v8.1.3
loading translations [en]... done
Converting `source_suffix = '.rst'` to `source_suffix = {'.rst': 'restructuredtext'}`.
loading intersphinx inventory 'python' from https://docs.python.org/3/objects.inv ...
loading intersphinx inventory 'packaging' from https://packaging.pypa.io/en/latest/objects.inv ...
building [mo]: targets for 0 po files that are out of date
writing output...
building [html]: targets for 11 source files that are out of date
updating environment: [new config] 11 added, 0 changed, 0 removed
reading sources... [100%] user_guide
looking for now-outdated files... none found
pickling environment... done
checking consistency... done
preparing documents... done
copying assets...
copying static files...
Writing evaluated template result to /home/martin/workspace/tox/.tox/docs_out/html/_static/basic.css
Writing evaluated template result to /home/martin/workspace/tox/.tox/docs_out/html/_static/documentation_options.js
Writing evaluated template result to /home/martin/workspace/tox/.tox/docs_out/html/_static/language_data.js
Writing evaluated template result to /home/martin/workspace/tox/.tox/docs_out/html/_static/copybutton.js
copying static files: done
copying extra files...
copying extra files: done
copying assets: done
writing output... [100%] user_guide
<unknown>:1: WARNING: py:class reference target not found: typing.Self [ref.class]
<unknown>:1: WARNING: py:class reference target not found: typing.Self [ref.class]
<unknown>:1: WARNING: py:class reference target not found: typing.Self [ref.class]
generating indices... genindex py-modindex done
writing additional pages... search done
copying images... [100%] img/overview_dark.svg
dumping search index in English (code: en)... done
dumping object inventory... done
build finished with problems, 3 warnings (with warnings treated as errors).
docs: exit 1 (7.11 seconds) /home/martin/workspace/tox> sphinx-build -d /home/martin/workspace/tox/.tox/docs/tmp/docs_tree docs /home/martin/workspace/tox/.tox/docs_out/html --color -b html -W pid=67962
.pkg: _exit> python /home/martin/micromamba/envs/tox/lib/python3.13/site-packages/pyproject_api/_backend.py True hatchling.build
docs: FAIL code 1 (8.00=setup[0.88]+cmd[7.11] seconds)
evaluation failed :( (8.07 seconds) |
|
I've noticed that the sponorlink (tidelift.com/funding/github/pypi/tox) doesn't seem to link to a funding page, but rather a general sales page of tidelift - is this indented? |
| @pytest.mark.parametrize( | ||
| ("env_list", "expected_envs"), | ||
| [ | ||
| ("py3{10-13}", ["py310", "py311", "py312", "py313"]), |
There was a problem hiding this comment.
I want to see tests for the case when:
a-b8-ba-9a--b
Also, what about:
9-7? Should we expand it or accept it? My initial thought is to expand it.
These cases should still be accepted, but not expanded.
There was a problem hiding this comment.
I've noticed that the sponorlink (tidelift.com/funding/github/pypi/tox) doesn't seem to link to a funding page, but rather a general sales page of tidelift - is this indented?
Yes.
There was a problem hiding this comment.
Both 11- and a- run into a ValueError in the factor computations (I used foo{11-} and foo{a-}).
I'll take a look at fixing that.
On that note: This feature introduces syntax in the ini file that is not backwards compatible - should we be concerned about this?
9-7 ? Should we expand it or accept it? My initial thought is to expand it.
The current implementation expands it to 9,8,7.
There was a problem hiding this comment.
Yeah, I'm happy with expansion.
Implements #3502. Now it is possible to use ranges within the {} of an env specifier such as py3{10-13}.
I chose to implement it as a pre-processing string replacement that just replaces the range with a literal enumeration of the range members. This is mainly to avoid more in-depth handling of these ranges when it coto generative environment lists.
Also moves CircularChainError from
of_typetotypesto avoid a circular import error. (kinda ironic :D)tox -e fix)docs/changelogfolderI hope my changes are fully backwards compatible - I added tests with all kind of combinations of generative environments - please let me know if you have some more test case suggestions 🙂