Add support for free-threaded Python (PEP 703)#1517
Open
Gaganraj2002 wants to merge 1 commit intoosprey-oss:mainfrom
Open
Add support for free-threaded Python (PEP 703)#1517Gaganraj2002 wants to merge 1 commit intoosprey-oss:mainfrom
Gaganraj2002 wants to merge 1 commit intoosprey-oss:mainfrom
Conversation
Build and test free-threaded (cp313t/cp314t) wheels across all platforms. CI changes: - Add 3.13t and 3.14t to test matrix in main.yml - Skip typing group install for free-threaded builds (mypy not yet compatible) - Add free-threaded wheel build steps to linux, windows, and macos release jobs - On Linux, manylinux containers bundle free-threaded interpreters natively - On Windows/macOS, install free-threaded Python after abi3 build to avoid interpreter detection conflicts (maturin-action#313) Tests: - Add concurrent thread-safety test exercising the Rust import extraction from multiple threads simultaneously The Rust extension (PyO3 0.28.2) already defaults to gil_used=false and has zero global mutable state, making it inherently thread-safe. PyO3 automatically ignores the abi3 feature flag when building for free-threaded Python, producing version-specific cp313t/cp314t wheels instead of abi3 wheels.
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.
Summary
Build and ship free-threaded Python (cp313t/cp314t) wheels, enabling deptry to work on Python built without the GIL.
Changes:
Release workflow (
.github/workflows/release.yml):python3.13t/python3.14tTest workflow (
.github/workflows/main.yml):3.13tand3.14tto the test matrixmypytyping group for free-threaded builds (not yet compatible)Tests:
tests/unit/test_thread_safety.pywith concurrent stress test exercising the Rust import extraction from 8 threads simultaneouslyWhy no Rust code changes are needed:
The extension already uses PyO3 0.28.2, which defaults to
gil_used = false. The Rust codebase has zero global mutable state, zerounsafeblocks, and zerostaticvariables — all functions are pure computations. PyO3 automatically ignores theabi3-py310feature flag when it detectsPy_GIL_DISABLED, producing version-specificcp313t/cp314twheels instead of abi3 wheels.Test plan
3.13tand3.14twith free-threaded Python