tox-gh icon indicating copy to clipboard operation
tox-gh copied to clipboard

Support for freethreaded Python variants (3.13t / 3.14t)?

Open ferdnyc opened this issue 4 months ago • 2 comments

As you may have heard, the "freethreaded" version of Python 3.13 (and soon, 3.14) — which removes the GIL, eliminating a bottleneck and allowing for improved concurrency under certain conditions — is all the rage lately. Many projects are rushing to test their packages under the GIL-less python3.13t or python3.14t binaries.

To facilitate this, actions/setup-python supports Python versions of "3.13t" and "3.14t", alongside the "3.13" and "3.14" versions that install the GIL-encumbered standard builds.

Unfortunately, it doesn't appear that even the latest tox-gh 1.5.0 is compatible with this scheme as of yet, since the following changes to my setup.cfg resulted in my python3.13t matrix job attempting to run the py313, ruff-check, and mypy-check Tox environments instead of the py313t environment defined for that CI instance. (And skipping py313 because an appropriate interpreter was not available.)

@@ -56,6 +65,9 @@ commands =
 # For tox-gh
 [gh]
 python =
+    3.14t = py314t
+    3.14 = py314
+    3.13t = py313t
     3.13 = ruff-check, mypy-check, py313
     3.12 = py312
     3.11 = py311

Is support for 3.13t / 3.14t in tox-gh a possibility?

ferdnyc avatar Sep 03 '25 18:09 ferdnyc

For now I've worked around this by setting the TOX_GH_MAJOR_MINOR environment variable to 3.13t in the freethreaded instance, which works fine and causes it to match the corresponding mapping in the gh.python table.

ferdnyc avatar Sep 03 '25 19:09 ferdnyc

(To save anyone looking to support this some time, recent versions of the virtualenv.discovery.py_info.PythonInfo class that tox-gh uses to query parameters of the various Python interpreters now include a free_threaded boolean member, which is set to True when Py_GIL_DISABLED is found in the interpreter's configuration.)

ferdnyc avatar Sep 03 '25 19:09 ferdnyc