Skip to content

✨ feat(toml): allow labeling a range factor group - #4049

Merged
gaborbernat merged 1 commit into
tox-dev:mainfrom
gaborbernat:feat-labeled-range-factor-group
Aug 28, 2026
Merged

✨ feat(toml): allow labeling a range factor group#4049
gaborbernat merged 1 commit into
tox-dev:mainfrom
gaborbernat:feat-labeled-range-factor-group

Conversation

@gaborbernat

Copy link
Copy Markdown
Member

Factor groups come in three shapes, and only two of them could be named. A list gains a label by nesting it under one, { django_version = ["django42", "django50"] }, but a range dict had no equivalent, so anyone wanting {factor:py_version} over a generated Python range had to abandon the range and write the versions out by hand (#4046).

A labeled group now accepts a range dict as its value, so { py_version = { prefix = "3.", start = 12, stop = 14 } } both expands to 3.12, 3.13, 3.14 and registers py_version for substitution. Reusing the existing single-key-table shape keeps one rule for naming a group, rather than adding a label key that only range dicts would honor. The same form works in env_base factors and in env_list product groups.

A labeled group whose value is a table without prefix is rejected with a message naming the label, since that table cannot be a range and would otherwise expand to nothing.

@gaborbernat gaborbernat added feature:new something does not exist yet, but should area:configuration labels Aug 28, 2026
@gaborbernat
gaborbernat force-pushed the feat-labeled-range-factor-group branch 4 times, most recently from 0f2e2d9 to f9d7cee Compare August 28, 2026 17:51
Range factor groups were the only shape that could not carry a label, so
a Python version matrix written as a range had to be spelled out as an
explicit list before {factor:py_version} could reach it.

Nesting the range under a name reuses the labeled-dict shape already in
place for lists. That keeps one rule to learn, a single-key table names
the group, instead of adding a `label` key that only ranges would honor.
@gaborbernat
gaborbernat force-pushed the feat-labeled-range-factor-group branch from f9d7cee to a973934 Compare August 28, 2026 18:19
@gaborbernat
gaborbernat marked this pull request as ready for review August 28, 2026 19:53
@gaborbernat
gaborbernat merged commit c1af929 into tox-dev:main Aug 28, 2026
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant