Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Free threaded Python support #3391

Open
Tracked by #229
fschulze opened this issue Oct 4, 2024 · 9 comments
Open
Tracked by #229

Free threaded Python support #3391

fschulze opened this issue Oct 4, 2024 · 9 comments
Assignees
Labels
enhancement help:wanted Issues that have been acknowledged, a solution determined and a PR might likely be accepted.

Comments

@fschulze
Copy link

fschulze commented Oct 4, 2024

I would like to be able to use py313t in the envlist to explicitly run python3.13t as a free-threaded nogil build in addition to py313 which would run python3.13 as an explicitly regular build.

Is there already some way to do that which I missed?

Currently py313t seems to use python.

Related:

@gaborbernat
Copy link
Member

Someone needs to add this functionality first inside virtualenv, or UV if you're ok using tox-uv...

@gaborbernat
Copy link
Member

You can always use https://tox.wiki/en/4.21.2/cli_interface.html#tox-run---discover in the meantime to force it...

@ssbarnea
Copy link
Member

ssbarnea commented Oct 4, 2024

IMHO that would likely be the most useful tox change to implement because 3.13t is very near and a major source of bugs. Making easy for people to test it with tox would be... very useful.

@gaborbernat
Copy link
Member

PR welcome.

@fschulze
Copy link
Author

fschulze commented Oct 4, 2024

Thanks for the pointer to --discover, that might already be enough for me. Will try later.

@ngoldbaum
Copy link

Sorry for duplicating the open issue. Now that virtualenv has done the release this is unblocked.

@ngoldbaum
Copy link

I tried running the tox test suite on a free-threaded Python, but that crashes because devpi depends on argon2-cffi-bindings, which itself depends on cffi. I think we'll have to wait on cffi before we can start working on other nodes in tox's dependency tree so we can add free-threaded CI.

Are you open to patches adding support for free-threading without being able to run the tox tests on CI? Or would you prefer to wait until all of tox's dependencies are ready? I'm happy either way, it's straightfoward to work around this with tox --discover.

@gaborbernat
Copy link
Member

I'm open to PRs. devpi is a test dependency, there can be a world where we can make the devpi tests skipped for free thread Pythons.

@dimaqq
Copy link

dimaqq commented Apr 2, 2025

I wonder if I'm running into this issue or a separate one...

  • uvx -p 3.14 tox -e foo uses uv's 3.14
  • uvx -p 3.14t tox -e unit falls back to system 3.10

Here are the verbose logs:

3.14 picked up:

🦐/c/operator (main) [5]> uvx -p 3.14 tox -vvv -e unit -- -k no-such-test-for-sure
ROOT: 54 D setup logging to NOTSET on pid 80517 [tox/report.py:222]
unit: 86 I find interpreter for spec PythonSpec(major=3, free_threaded=False) [virtualenv/discovery/builtin.py:76]
unit: 86 D got python info of /Users/dima/.local/share/uv/python/cpython-3.14.0a5-macos-aarch64-none/bin/python3.14 from /Users/dima/Library/Application Support/virtualenv/py_info/2/dfb1b237081bd267cf8d923219686080ce3c6f00c917defd01b16097e08ea02e.json [virtualenv/app_data/via_disk_folder.py:132]
unit: 87 D filesystem is not case-sensitive [virtualenv/info.py:27]
unit: 87 I proposed PythonInfo(spec=CPython3.14.0.alpha.5-64, system=/Users/dima/.local/share/uv/python/cpython-3.14.0a5-macos-aarch64-none/bin/python3.14, exe=/Users/dima/Library/Caches/uv/archive-v0/oNuir8gEbhBnRYtG6RVFG/bin/python, platform=darwin, version='3.14.0a5 (main, Feb 12 2025, 15:01:40) [Clang 19.1.6 ]', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:83]
unit: 87 D accepted PythonInfo(spec=CPython3.14.0.alpha.5-64, system=/Users/dima/.local/share/uv/python/cpython-3.14.0a5-macos-aarch64-none/bin/python3.14, exe=/Users/dima/Library/Caches/uv/archive-v0/oNuir8gEbhBnRYtG6RVFG/bin/python, platform=darwin, version='3.14.0a5 (main, Feb 12 2025, 15:01:40) [Clang 19.1.6 ]', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:85]
unit: 98 W commands[0]> pytest -n auto --ignore=test/smoke --ignore=test/benchmark --ignore=testing/tests/benchmark -v --tb native -W 'ignore:Harness is deprecated:PendingDeprecationWarning' -k no-such-test-for-sure [tox/tox_env/api.py:434]
============================================================================================================ test session starts ============================================================================================================
platform darwin -- Python 3.14.0a5, pytest-7.4.4, pluggy-1.5.0 -- /code/operator/.tox/unit/bin/python
cachedir: .tox/unit/.pytest_cache
rootdir: /code/operator
plugins: xdist-3.6.1
8 workers [0 items]
scheduling tests via LoadScheduling

=========================================================================================================== no tests ran in 0.92s ===========================================================================================================
unit: 1124 C exit 5 (1.03 seconds) /code/operator> pytest -n auto --ignore=test/smoke --ignore=test/benchmark --ignore=testing/tests/benchmark -v --tb native -W 'ignore:Harness is deprecated:PendingDeprecationWarning' -k no-such-test-for-sure pid=80521 [tox/execute/api.py:294]
  unit: FAIL code 5 (1.04=setup[0.02]+cmd[1.03] seconds)
  evaluation failed :( (1.07 seconds)

3.14t is not picked up:

🦐/c/operator (main) [5]> uvx -p 3.14t tox -vvv -e unit -- -k no-such-test-for-sure
ROOT: 91 D setup logging to NOTSET on pid 80698 [tox/report.py:222]
unit: 139 I find interpreter for spec PythonSpec(major=3, free_threaded=False) [virtualenv/discovery/builtin.py:76]
unit: 140 D got python info of /Users/dima/.local/share/uv/python/cpython-3.14.0a6+freethreaded-macos-aarch64-none/bin/python3.14t from /Users/dima/Library/Application Support/virtualenv/py_info/2/ccaa4a52229fbe07aa3233216e2fc65c9dd19ab780e1961f8c82b5db8beda128.json [virtualenv/app_data/via_disk_folder.py:132]
unit: 140 D filesystem is not case-sensitive [virtualenv/info.py:27]
unit: 140 I proposed PythonInfo(spec=CPython3.14.0.alpha.6t-64, system=/Users/dima/.local/share/uv/python/cpython-3.14.0a6+freethreaded-macos-aarch64-none/bin/python3.14t, exe=/Users/dima/Library/Caches/uv/archive-v0/klrvJ_abHkW79LscmIe0O/bin/python, platform=darwin, version='3.14.0a6 experimental free-threading build (main, Mar 17 2025, 21:29:21) [Clang 20.1.0 ]', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:83]
unit: 141 D discover PATH[0]=/Users/dima/Library/Caches/uv/archive-v0/klrvJ_abHkW79LscmIe0O/bin [virtualenv/discovery/builtin.py:152]
unit: 141 D got python info of /Users/dima/Library/Caches/uv/archive-v0/klrvJ_abHkW79LscmIe0O/bin/python3 from /Users/dima/Library/Application Support/virtualenv/py_info/2/1668fb1acb8a7f18f345851334a055ecde666c86e44ca568354f1ec0e9f2ee3c.json [virtualenv/app_data/via_disk_folder.py:132]
unit: 141 I proposed PythonInfo(spec=CPython3.14.0.alpha.6t-64, system=/Users/dima/.local/share/uv/python/cpython-3.14.0a6+freethreaded-macos-aarch64-none/bin/python3.14t, exe=/Users/dima/Library/Caches/uv/archive-v0/klrvJ_abHkW79LscmIe0O/bin/python3, platform=darwin, version='3.14.0a6 experimental free-threading build (main, Mar 17 2025, 21:29:21) [Clang 20.1.0 ]', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:83]
unit: 141 D got python info of /Users/dima/Library/Caches/uv/archive-v0/klrvJ_abHkW79LscmIe0O/bin/python3.14 from /Users/dima/Library/Application Support/virtualenv/py_info/2/f7bc8c53406420ed5492b3923dcde6676cc9095f1d6514cf0b874c3b55941d57.json [virtualenv/app_data/via_disk_folder.py:132]
unit: 142 D discover PATH[1]=/Library/Frameworks/Python.framework/Versions/3.10/bin [virtualenv/discovery/builtin.py:152]
unit: 142 D got python info of /Library/Frameworks/Python.framework/Versions/3.10/bin/python3 from /Users/dima/Library/Application Support/virtualenv/py_info/2/98590ff4fe04c8543246b2a01debd3de3c5ca9b666f43f1fa87d5110c692004c.json [virtualenv/app_data/via_disk_folder.py:132]
unit: 142 I proposed PathPythonInfo(spec=CPython3.10.11.final.0-64, exe=/Library/Frameworks/Python.framework/Versions/3.10/bin/python3, platform=darwin, version='3.10.11 (v3.10.11:7d4cc5aa85, Apr  4 2023, 19:05:19) [Clang 13.0.0 (clang-1300.0.29.30)]', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:83]
unit: 142 D accepted PathPythonInfo(spec=CPython3.10.11.final.0-64, exe=/Library/Frameworks/Python.framework/Versions/3.10/bin/python3, platform=darwin, version='3.10.11 (v3.10.11:7d4cc5aa85, Apr  4 2023, 19:05:19) [Clang 13.0.0 (clang-1300.0.29.30)]', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:85]
unit: 166 W commands[0]> pytest -n auto --ignore=test/smoke --ignore=test/benchmark --ignore=testing/tests/benchmark -v --tb native -W 'ignore:Harness is deprecated:PendingDeprecationWarning' -k no-such-test-for-sure [tox/tox_env/api.py:434]
============================================================================================================ test session starts ============================================================================================================
platform darwin -- Python 3.10.11, pytest-7.4.4, pluggy-1.5.0 -- /code/operator/.tox/unit/bin/python
cachedir: .tox/unit/.pytest_cache
rootdir: /code/operator
plugins: xdist-3.6.1
8 workers [0 items]
scheduling tests via LoadScheduling

=========================================================================================================== no tests ran in 0.99s ===========================================================================================================
unit: 1273 C exit 5 (1.11 seconds) /code/operator> pytest -n auto --ignore=test/smoke --ignore=test/benchmark --ignore=testing/tests/benchmark -v --tb native -W 'ignore:Harness is deprecated:PendingDeprecationWarning' -k no-such-test-for-sure pid=80702 [tox/execute/api.py:294]
  unit: FAIL code 5 (1.14=setup[0.03]+cmd[1.11] seconds)
  evaluation failed :( (1.18 seconds)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement help:wanted Issues that have been acknowledged, a solution determined and a PR might likely be accepted.
Projects
None yet
Development

No branches or pull requests

5 participants