Skip to content

πŸ› fix(config): don't read dashed version factors as a range - #4380

Merged
gaborbernat merged 2 commits into
tox-dev:mainfrom
ericdelorefice:fix-dashed-range-factor
Nov 4, 2026
Merged

gaborbernat merged 2 commits into
tox-dev:mainfrom
ericdelorefice:fix-dashed-range-factor

Conversation

@ericdelorefice

@ericdelorefice ericdelorefice commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

An env_list that spells a version with dashes, such as py-django-4-2, py-django-5-0, was split into made-up environments (py-django-4, 3, 2) without any warning, and which entry broke depended on the order of the list. πŸ› Such names now stay one environment, whether they come from env_list, -e on the command line, or a factor condition.

Range expansion now recognizes a range only where an environment name or a brace item starts. #4053 already kept digits that continue a name, as in django4-2, out of ranges; this applies the same rule to digits after a -. Braced ranges, the only form documented since ranges arrived in #3503, keep expanding: py-django-{4-5} still gives py-django-4 and py-django-5.

An unbraced range after a dash, such as py-1-3 or {py-1-3,x}, no longer expands. Neither form was documented, and both produced broken names before: {py-1-3,x} became py-1, 2, 3 and x. The configuration reference now says where a range may start and shows the braced form to use after a -.

I used Claude Code to help with this; I've checked and can explain every line.

  • ran the linter to address style issues (tox -e fix)
  • wrote descriptive pull request text
  • ensured there are test(s) validating the fix
  • added a docs/changelog fragment for user-facing changes, or applied skip news
  • updated/extended the documentation
  • ran tests on Python 3.11 and 3.15 (tox run -e 3.11,3.15)
  • linked upstream issues beside any temporary interpreter overrides
  • kept the PR in draft until CI passes

Outside braces, a pair of numbers after a dash, as in py-django-4-2, split the env into py-django-4, 3 and 2. Braced ranges such as py-django-{4-5} still expand.
@ericdelorefice
ericdelorefice force-pushed the fix-dashed-range-factor branch from f88a41c to c948ee2 Compare November 4, 2026 15:57
@ericdelorefice
ericdelorefice marked this pull request as ready for review November 4, 2026 16:58
The new lookbehind also applies inside braces, so {py-1-3,x} stays as
written. The regex comment said the rule held outside braces, and the
docs said a range opens wherever a factor starts, which stopped being
true once a factor after a dash could no longer open one. Both now say a
range opens only where an environment or a brace item starts. Pin the
brace case in tests.
@gaborbernat gaborbernat added the bug A confirmed defect label Nov 4, 2026
@gaborbernat
gaborbernat merged commit abcba3a into tox-dev:main Nov 4, 2026
33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug A confirmed defect

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants