Skip to content

🐛 fix(config): allow glob patterns in ini depends#3825

Merged
gaborbernat merged 2 commits intotox-dev:mainfrom
gaborbernat:fix-glob-depends
Feb 25, 2026
Merged

🐛 fix(config): allow glob patterns in ini depends#3825
gaborbernat merged 2 commits intotox-dev:mainfrom
gaborbernat:fix-glob-depends

Conversation

@gaborbernat
Copy link
Copy Markdown
Member

Glob patterns like depends = 3.* in tox.ini files crash because the ini loader's factor expansion rejects * and ? characters via _FACTOR_RE. 🐛 The same patterns work fine in tox.toml because the TOML loader creates EnvList directly from string values, bypassing factor expansion entirely. This is tracked in #3822.

The fix adds glob wildcard characters to _FACTOR_RE's character classes so patterns pass through factor expansion unchanged. The actual glob matching is already handled downstream by fnmatchcase in run_order, so no additional matching logic is needed.

✨ All static regex patterns across the codebase have also been converted to verbose format (re.VERBOSE) for readability, and a duplicated inline re.sub pattern in req_file.py has been extracted into a shared compiled constant.

Fixes #3822

The _FACTOR_RE regex rejected * and ? characters, causing glob patterns
like `depends = 3.*` to crash when used in tox.ini files. TOML worked
because it bypasses factor expansion entirely.

Adding glob wildcards to the factor regex lets patterns pass through to
the downstream fnmatchcase matching that already handles them correctly.

Also converts all static regexes project-wide to verbose format and
extracts the duplicated unescaped-space pattern in req_file.py into a
shared compiled constant.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@gaborbernat gaborbernat added bug:normal affects many people or has quite an impact area:configuration labels Feb 25, 2026
@gaborbernat gaborbernat enabled auto-merge (squash) February 25, 2026 13:52
@gaborbernat gaborbernat merged commit 5045709 into tox-dev:main Feb 25, 2026
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:configuration 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.

glob pattern support for depends option doesn't work with ini files

1 participant