Skip to content

✨ feat(spec): accept build suffixes on version specifiers - #176

Merged
gaborbernat merged 1 commit into
tox-dev:mainfrom
gaborbernat:fix/free-threaded-specifier
Oct 30, 2026
Merged

gaborbernat merged 1 commit into
tox-dev:mainfrom
gaborbernat:fix/free-threaded-specifier

Conversation

@gaborbernat

Copy link
Copy Markdown
Member

Since 1.6.6, >=3.13t is looked up as an executable named >=3.13t (#175), so tools such as nox that let users write python=">=3.13t" find nothing. Before 1.6.6 the spec parsed, but discovery raised AssertionError on the unreadable 3.13t item, and under -O it dropped the t and could pick a GIL build. ✨ Once this merges, >=3.13t asks for a free-threaded 3.13 or newer, and the other build suffixes work on ranges too: cpython>=3.11,<3.14-64 asks for a 64-bit CPython in that range.

Plain specs (python3.13td-64-arm64) and specifiers now share one grammar for the trailing build modifiers: t, d/-dbg/-debug, -32/-64 and -<machine>. On a specifier they follow the last item and apply to the whole set, the same place uv puts the variant in a --python request. Without t a specifier still accepts any build, so existing ranges match the same interpreters as before.

⚠️ Behavior change

A spec that starts with a comparison operator but doesn't parse, such as >=3.13., >=3.x, >=3.12 <4 (missing comma) or >=3.13t,<3.15 (a flag on an inner item), now raises ValueError naming the spec. In 1.6.6 and 1.6.7 it became a literal executable name, which matched nothing and let a key list move on to the next entry. Callers that pass user input straight to get_interpreter or PythonSpec.from_string_spec see the error instead of a silent miss; wntrblm/nox#1217 handles unparsable ranges by checking for that literal-path result, so it needs to catch the ValueError instead.

Specifiers now take the same trailing t, d/-dbg/-debug, -32/-64 and
-<machine> parts as plain specs, once after the last item, so >=3.13t
asks for a free-threaded 3.13 or newer. Both patterns share one modifier
grammar so the two forms cannot drift apart again.

A spec that starts with a comparison operator but does not parse now
raises ValueError naming it, instead of being looked up as an executable.

Closes tox-dev#175
@gaborbernat gaborbernat added the enhancement New feature or request label Oct 30, 2026
@gaborbernat
gaborbernat merged commit 09e9f6f into tox-dev:main Oct 30, 2026
20 of 21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant