Add support for free-threaded Python (PEP 703)#952
Conversation
Builds on python-pendulum#940 — completes the remaining work for free-threaded support. Rust: - Add `gil_used = false` to `#[pymodule]` (PyO3 0.27 defaults to true) - Codebase has zero global state, zero unsafe — all functions are pure CI (tests.yml): - Add 3.13t and 3.14t to test matrix - Skip mypy/typing deps for free-threaded builds (not yet compatible) CI (release.yml): - Add free-threaded wheel build step (3.13t/3.14t) in the build job - Skipped for PyPy matrix entries Tests: - Add concurrent thread-safety tests for parse, now, duration, diff, format
Do you know of an issue tracking the support for that? |
|
hey! the main tracking was mypyc/mypyc#1038 — it's closed now since basic support landed. mypy ships cp314t wheels but cp313t still doesn't have them. and even on 3.14t the mypyc support is still described as "not memory safe" under concurrent access by JukkaL himself (Sep 2025 comment on that issue). so figured safer to just skip it for now instead of dealing with potential flaky CI. |
|
Hey. Let's remove |
|
Done. |
|
The new test file is missing type annotations. If you don't feel like adding them, you can add them to the list in pyproject.toml |
|
for now i have added it into the pyproject.toml |
Builds on #940 — this completes the remaining work for free-threaded Python support.
Changes
Rust (
rust/src/python/mod.rs):gil_used = falseto#[pymodule]declaration (PyO3 0.27 defaults totrue)unsafeblocks, and zerostaticvariables — all functions are pure computations, making it inherently thread-safeTest workflow (
.github/workflows/tests.yml):3.13tand3.14tto the test matrixRelease workflow (
.github/workflows/release.yml):--interpreter 3.13t 3.14t) in the build jobTests:
tests/test_thread_safety.pywith concurrent stress tests forparse,now,duration,diff, andformat(8 threads x 200 iterations each)Test plan
3.13tand3.14t