correctly match free-threaded python versions#999
Merged
henryiii merged 1 commit intowntrblm:mainfrom Oct 8, 2025
Merged
Conversation
in the case where nox is run given an explicit python version target to run on, nox locates Python interpreters by matching that interpreter string to a regex, that is then expanded to match the name of a Python executable by appending the numeric portions of the version to the word "python", its existence is verified with shutil.which(), and is then passed off to virtualenv as a target to use. However, if the explicit python version ends in "t" for a free-threaded python, such as "3.13t", the regex does not match, due to that "t" that's present which isn't included in the regex. This PR fixes the regex to also look for a "t" at the end for a free-threaded version name, and formats it into the interpreter name virtualenv will look for. There's a bit of a secondary issue which is that if you are trying to select for "3.13" non-free-threaded, but you have a free-threaded 3.13t in your path as well, that "python3.13" name matches in the free-threaded bin folder as well, but virtualenv seems to know how to make the right choice in this case. The only issue I could find regarding free-threading is wntrblm#949 which vaguely claims that free-threading is working, however this patch is needed if you actually want to indicate the Python version. Fixes: wntrblm#949
Contributor
Author
|
TIL I can also send the full executable name like |
Contributor
Author
|
ah it fails when we use pytest-xdist and run in separate processes. |
henryiii
approved these changes
Oct 8, 2025
|
Thank you for fixing this! I had only used nox with projects that don't use any of the python environment setup features and just |
sqlalchemy-bot
pushed a commit
to sqlalchemy/sqlalchemy
that referenced
this pull request
Oct 18, 2025
the workaround for [1] no longer works now that the fix has been committed. slightly surprising but just require that version of nox and carry on [1] wntrblm/nox#999 Change-Id: I4b4031c3d3d02399f55f9750237de61e5e90d179
sqlalchemy-bot
pushed a commit
to sqlalchemy/alembic
that referenced
this pull request
Oct 18, 2025
includes fix for wntrblm/nox#999 Change-Id: Id38dc01a1fb8a7446e427a8cf9a0cae2db6c4a3b
sqlalchemy-bot
pushed a commit
to sqlalchemy/dogpile.cache
that referenced
this pull request
Oct 18, 2025
includes fix for wntrblm/nox#999 Change-Id: Id38dc01a1fb8a7446e427a8cf9a0cae2db6c4a3b
sqlalchemy-bot
pushed a commit
to sqlalchemy/sqlalchemy
that referenced
this pull request
Oct 21, 2025
the workaround for [1] no longer works now that the fix has been committed. slightly surprising but just require that version of nox and carry on [1] wntrblm/nox#999 Change-Id: I4b4031c3d3d02399f55f9750237de61e5e90d179 (cherry picked from commit e1f3b43)
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.
in the case where nox is run given an explicit python version target to run on, nox locates Python interpreters by matching that interpreter string to a regex, that is then expanded to match the name of a Python executable by appending the numeric portions of the version to the word "python", its existence is verified with
shutil.which(), and is then passed off to virtualenv as a target to use.
However, if the explicit python version ends in "t" for a free-threaded python, such as "3.13t", the regex does not match, due to that "t" that's present which isn't included in the regex.
This PR fixes the regex to also look for a "t" at the end for a free-threaded version name, and formats it into the interpreter name virtualenv will look for.
There's a bit of a secondary issue which is that if you are trying to select for "3.13" non-free-threaded, but you have a free-threaded 3.13t in your path as well, that "python3.13" name matches in the free-threaded bin folder as well, but virtualenv seems to know how to make the right choice in this case.
The only issue I could find regarding free-threading is #949 which vaguely claims that free-threading is working, however this patch is needed if you actually want to indicate the Python version.
Fixes: #949