Fix env name with dot losing description in TOML config#3722
Merged
gaborbernat merged 3 commits intotox-dev:mainfrom Feb 17, 2026
Merged
Fix env name with dot losing description in TOML config#3722gaborbernat merged 3 commits intotox-dev:mainfrom
gaborbernat merged 3 commits intotox-dev:mainfrom
Conversation
Environment names containing dots (e.g. "py3.11") in pyproject.toml had their descriptions silently ignored. `tox list` showed `[no description]` instead of the configured description. Root cause: Three interrelated issues in toml_pyproject.py: 1. `sections()` called `from_key(env_name)` which splits on the first dot (the TOML SEP), turning "py3.11" into Section(prefix="py3", name="11") — wrong decomposition. 2. The `keys` property split the full key on ALL dots, so "tool.tox.env.py3.11" became ["env", "py3", "11"] instead of ["env", "py3.11"]. `get_loader()` then tried to traverse dict["py3"]["11"] instead of dict["py3.11"], silently failing. 3. `envs()` yielded `section.key` (the full dotted path) instead of `section.name` (the env name), causing duplicate entries when `sections()` was fixed to use `test_env()`. Fix: - `keys`: build from prefix/name components directly instead of splitting the joined key, preserving dots within the name. - `sections()`: use `test_env(env_name)` which correctly sets prefix="tool.tox.env" and name="py3.11" as a single unit. - `envs()`: yield `section.name` instead of `section.key`. - `get_base_sections()`: use `test_env()` for consistency. Closes tox-dev#3590
for more information, see https://pre-commit.ci
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #3590
Environment names containing dots (e.g.
"py3.11") inpyproject.tomlhad their descriptions silently ignored.tox listshowed[no description]instead of the configured description.Reproducer
Root cause
Three interrelated issues in
toml_pyproject.py:sections()split the env name on dots:from_key("py3.11")treats.as the section separator, creatingSection(prefix="py3", name="11")instead of preserving"py3.11"as the name.keysproperty split ALL dots: The full key"tool.tox.env.py3.11"was split into["env", "py3", "11"].get_loader()then tried to traversedict["py3"]["11"]instead ofdict["py3.11"], returningNone(config not found).envs()yielded full key: Whensections()is fixed to usetest_env(), the full key becomes"tool.tox.env.py3.11"instead of just"py3.11", causing a phantom duplicate environment.Fix
keysproperty: Build fromprefixandnamecomponents directly instead of splitting the joined key onSEP. This preserves dots within the env name while still splitting structural path separators.sections(): Usetest_env(env_name)which correctly setsprefix="tool.tox.env"andname="py3.11"as an atomic unit.envs(): Yieldsection.nameinstead ofsection.keyto return just the env name.get_base_sections(): Usetest_env()for consistency.After fix