✨ feat(config): add env_base templates for TOML#3817
Merged
gaborbernat merged 3 commits intotox-dev:mainfrom Feb 24, 2026
Merged
✨ feat(config): add env_base templates for TOML#3817gaborbernat merged 3 commits intotox-dev:mainfrom
gaborbernat merged 3 commits intotox-dev:mainfrom
Conversation
6f2e61d to
7070482
Compare
Creating multiple environments that share configuration required
repeating settings across individual [env.X] sections. env_base
introduces named templates with a factors key that generates
environments via Cartesian product, inheriting all template settings.
The inheritance chain resolves as env.{name} > env_base.{template} >
env_run_base, keeping explicit overrides possible while eliminating
repetition for environment matrices.
43c0d83 to
b11394b
Compare
for more information, see https://pre-commit.ci
Use Unicode → instead of undefined RST |rarr| substitution in config.rst, and move changelog fragment to flat naming convention expected by pre-commit hook. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
a1cbcb4 to
48748b2
Compare
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.
Creating multiple TOML environments that share configuration (deps, commands, base_python) currently requires repeating those settings in every
[env.X]section, or using a shared base that still appears as a runnable environment. This becomes painful when testing across a matrix of Python versions and framework versions.env_baseintroduces named templates with afactorskey that generates concrete environments via Cartesian product. A single[env_base.django]section withfactors = [["py312", "py313"], ["django42", "django50"]]produces four environments, each inheriting the template's settings and resolvingfactor.Xconditions independently. ✨ The inheritance chain is[env.{name}]>[env_base.{template}]>[env_run_base], so explicit per-environment overrides remain possible while eliminating repetition.Factor groups support plain string lists, range dicts (
{ prefix = "py3", start = 12, stop = 14 }), and mixtures of both for Cartesian products. Template names themselves never appear as runnable environments -- only the generated names show up intox listand can be executed. Missing or malformedfactorskeys produce clear error messages directing users to[env.X]for single environments.