ci: test the free-threaded Python 3.14 build - #361
Open
pavlosambur wants to merge 2 commits into
Open
Conversation
Free threading is officially supported since Python 3.14 (PEP 779), but the free-threaded build was not exercised anywhere. Under xdist this plugin runs a socket server in the master to coordinate reruns across workers, spawning a thread per worker connection and sharing StatusDB behind a lock, so it is worth running the suite without the GIL. Add a py314t tox environment and a matching CI job. The job asserts that the GIL is still disabled after importing the test dependencies, since importing an extension that does not declare free-threading support re-enables it and would leave the job silently testing nothing. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Author
|
CI here needs maintainer approval since this is my first PR to this repo. In the meantime I ran the same workflow on my fork, on the same commit as this PR: https://github.com/pavlosambur/pytest-rerunfailures/actions/runs/33974552487 All 30 jobs pass, including the new |
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.
Free threading is officially supported as of Python 3.14 (PEP 779), but the
free-threaded build is not exercised anywhere in CI right now.
This matters more here than for a typical pure-Python package. Under xdist the
master runs a
ServerStatusDBthat workers connect to over a socket(
src/pytest_rerunfailures.pyL597-605); the server itself runs in a backgroundthread (L785-786) and spawns a thread per worker connection (L795-797), with
shared state guarded by
_suite_lock(L686). That is real concurrency, and ithas never been run without the GIL.
Changes:
py314t-pytest91-xdisttox environmentfree-threading:py-3.14t:pytest-9.1CI job, structured as a copy of theexisting
xdistjob — that one also installs dependencies with pip ratherthan going through tox, so this mirrors the existing convention
sys._is_gil_enabled()is false after importing pytest,xdist and the plugin, so it fails loudly instead of silently testing an
interpreter that quietly re-enabled the GIL
Verified locally on a real GIL-disabled interpreter (
Py_GIL_DISABLED=1,sys._is_gil_enabled()returns False):tox -e py314t-pytest91-xdistgives201 passed.
tox -e lintingis green.Deliberately left out: the
Free Threadingtrove classifier. Advertisingsupport in the same PR that starts testing it felt premature — happy to send
that separately once this job has been green for a while.
Unrelated, noticed while working on this:
allow-prereleases: truein theexisting 3.14 jobs is now a no-op, since 3.14 is marked stable in
actions/python-versions. Happy to clean that up in a follow-up if useful.
Worked on this with Claude as an assistant; the reasoning above is mine
and I ran everything locally.