Skip to content

🐛 fix(config): support base inherit in TOML format#3754

Merged
gaborbernat merged 1 commit intotox-dev:mainfrom
gaborbernat:fix-toml-base-inherit-3497
Feb 18, 2026
Merged

🐛 fix(config): support base inherit in TOML format#3754
gaborbernat merged 1 commit intotox-dev:mainfrom
gaborbernat:fix-toml-base-inherit-3497

Conversation

@gaborbernat
Copy link
Member

The base configuration key allows environments to inherit settings from arbitrary sections, which is useful for sharing configuration across multiple environments without repeating it. This worked correctly in INI format (e.g. base = py_base in [testenv:py3.11] resolving [testenv:py_base]) but silently failed in TOML format — base = ["shared"] in [env.a] would not find [env.shared]. 🔍

The INI source already handled this by looking up base entries at both the explicit level and within the current section's prefix (e.g. testenv). The TOML source was missing this second lookup, only searching at the top level where environment sections don't live. The fix aligns TOML with INI by also yielding a section scoped to the current prefix, so base = ["shared"] correctly resolves against [env.shared] in both tox.toml and pyproject.toml.

This is a pure bugfix — existing configurations that don't use base in TOML are unaffected. Users who previously worked around this limitation by duplicating configuration across TOML environment sections can now use base as intended.

Fixes #3497

@gaborbernat gaborbernat added the bug:normal affects many people or has quite an impact label Feb 18, 2026
The `base` configuration key for inheriting from arbitrary testenv
sections worked in INI format but silently failed in TOML. This was
because the TOML source only looked up base sections at the core
level (e.g. top-level `py_base` key), missing sections nested under
the `env` table where environments are actually defined.

Aligned TOML with INI behavior by also yielding a section using the
current section's prefix, so `base = ["shared"]` in `[env.a]` now
correctly resolves `[env.shared]`.

Fixes tox-dev#3497
@gaborbernat gaborbernat force-pushed the fix-toml-base-inherit-3497 branch from a7443c3 to 8104aad Compare February 18, 2026 14:03
@gaborbernat gaborbernat enabled auto-merge (squash) February 18, 2026 14:06
@gaborbernat gaborbernat merged commit b5e33a6 into tox-dev:main Feb 18, 2026
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bot:chronographer:provided bug:normal affects many people or has quite an impact

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Inherit configuration from arbitrary section within TOML

1 participant

Comments