Skip to content

feat: create free-threaded python wheels#1553

Draft
timsaucer wants to merge 14 commits into
apache:mainfrom
timsaucer:feat/freethreaded-python
Draft

feat: create free-threaded python wheels#1553
timsaucer wants to merge 14 commits into
apache:mainfrom
timsaucer:feat/freethreaded-python

Conversation

@timsaucer
Copy link
Copy Markdown
Member

Which issue does this PR close?

Closes #1324

Rationale for this change

Starting in Python 3.14 free-threaded support is no longer experimental.

What changes are included in this PR?

Update build to support free-threaded Python wheels.

Are there any user-facing changes?

None

timsaucer and others added 14 commits May 20, 2026 13:12
The free-threaded matrix entries skip `uv sync` to avoid resolving
project dependencies against cp313t/cp314t (many dev deps lack
free-threaded wheels), so `uv run --no-project maturin` failed on
macOS/Windows with "Failed to spawn: `maturin`". Switch to
`uvx maturin@1.8.1`, which runs maturin in an isolated tool env
independent of the project venv and matches the pin used by
maturin-action for manylinux builds.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
maturin's `--interpreter python3.14t` fails on Windows because the
free-threaded build ships as plain `python.exe` (no `tN` suffix). Look
up `sys.executable` of the python on PATH (which actions/setup-python
prepends with the free-threaded install), assert
`Py_GIL_DISABLED == 1` so a misconfigured PATH can't silently build a
GIL wheel, and normalize backslashes to forward slashes so the path
survives re-expansion in the downstream `run:` line.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Windows free-threaded Python does not expose `abiflags` in sysconfig,
so PyO3's default Windows linkage path fails with "A python 3
interpreter on Windows does not define abiflags in its sysconfig ಠ_ಠ"
when building cp31Xt wheels. Enabling the `generate-import-lib` PyO3
feature switches Windows builds to a generated import library
(provided by the `python3-dll-a` crate) that does not depend on a
fully populated sysconfig. It is a no-op on macOS and Linux and is
compatible with the existing `abi3` feature.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
maturin 1.8.1 errors out on Windows free-threaded interpreters with
"A python 3 interpreter on Windows does not define abiflags in its
sysconfig" even when given a valid `python.exe`. Newer maturin
releases handle the missing abiflags gracefully for cp31Xt builds.
Bump both the `uvx maturin@` pin used for native macOS/Windows wheels
and the `maturin-version` passed to PyO3/maturin-action for the
manylinux containers.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The mac/Windows matrix shared a single name template that prepended
"macOS arm64 & Windows" to every entry, which got truncated in the
GitHub UI sidebar and made it hard to tell macOS and Windows runs
apart. Rename all wheel build jobs to the same pattern so the OS,
architecture, and python tag are visible at a glance:

- Linux x86_64 / arm64
- macOS arm64 / x86_64
- Windows x86_64

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
pygithub pulls in cryptography via pyjwt[crypto]. cryptography 44.0.0
ships only abi3 wheels, which free-threaded interpreters cannot use, so
uv builds it from sdist; its bundled PyO3 0.23.2 caps at Python 3.13 and
fails on 3.14t. pygithub is only used by the manual release changelog
script, so move it out of the dev group into a new release group.
'uv sync --dev' (used by CI test jobs) no longer drags in cryptography.
Passing a bare version like '3.13t' to 'uv venv --python' let uv fall
back to a different system interpreter (3.12), creating a venv whose ABI
did not match the downloaded cp313t wheel and failing the install. Use
the python-path output from setup-python so the venv uses exactly the
interpreter that was set up.
Pinning only 'uv venv --python' was not enough: 'uv sync' ignores the
existing .venv, runs its own interpreter discovery, and recreated the
venv with the system 3.12, again mismatching the cp313t wheel. Set
UV_PYTHON to the setup-python interpreter for the install and test
steps so every uv command (venv, sync, pip, run) uses it.
Setting UV_PYTHON on the test step pointed 'uv run --no-project pytest'
at the setup-python interpreter, which has no pytest installed, causing
'Failed to spawn: pytest'. UV_PYTHON is only needed in the install step
to build the .venv with the right interpreter; the test step must use
that .venv. Drop UV_PYTHON from the test step.

Co-Authored-By: Claude <noreply@anthropic.com>
Setting UV_PYTHON as a step env split the install across two
environments: 'uv sync' populated .venv while 'uv pip install' targeted
the bare setup-python interpreter, so the datafusion wheel never landed
in .venv and 'import datafusion' failed under pytest. Pin the
interpreter at 'uv venv --python', activate the venv, and pass --active
to 'uv sync' so sync and pip install both target the same .venv.

Co-Authored-By: Claude <noreply@anthropic.com>
Activating the venv and passing --active still let 'uv sync' run its own
interpreter discovery, which skips free-threaded builds and re-picked the
system 3.12, recreating .venv and breaking the cp313t/cp314t wheel
install. Pass the venv's own interpreter (.venv/bin/python) explicitly to
'uv sync', 'uv pip install', and 'uv run' so every step stays in the
free-threaded environment created by 'uv venv'.

Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for free threaded python

1 participant