🐛 fix(config): prevent env_run_base deps from being clobbered#3721
Merged
gaborbernat merged 2 commits intotox-dev:mainfrom Feb 17, 2026
Merged
Conversation
…ed as environments
When users referenced env_run_base or env_pkg_base sections in TOML config
using the syntax deps = ["{[tool.tox.env_run_base]deps}", "extra-dep"], the
reference expansion logic incorrectly treated these special base sections as
regular test environments. This caused the configuration system to create a
virtual environment named "run_base" instead of reading the raw configuration
values, resulting in additional dependencies being silently dropped.
The bug occurred because the section name "tool.tox.env_run_base" starts with
the environment prefix "tool.tox.env", triggering environment lookup logic
that should only apply to actual test environments like "tool.tox.env.py311".
Fixed by explicitly checking if the section matches the exact names of the
special base sections (env_run_base and env_pkg_base) before attempting
environment resolution, ensuring these are always treated as raw configuration
sections rather than environment references.
for more information, see https://pre-commit.ci
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.
When users configure TOML environments with
deps = ["{[tool.tox.env_run_base]deps}", "extra-dep"], the additional dependencies were silently dropped and only the base section deps were installed. This breaks a natural pattern for extending base configurations, making it impossible to share common dependencies across environments while adding environment-specific ones. 🔧The configuration reference expansion logic incorrectly treated
env_run_baseandenv_pkg_baseas regular test environments because their section names start with the environment prefixtool.tox.env. This caused the system to attempt creating a virtual environment namedrun_baseinstead of reading the raw configuration values, breaking the reference expansion and silently discarding any additional dependencies in the list.The fix adds an explicit check to exclude these special base sections from environment resolution, ensuring they're always treated as raw configuration sections. This preserves the intended behavior where base sections can be referenced alongside additional values without data loss. ✨
Closes #3393