Skip to content

✨ enable free-threaded Python 3.14t support#23

Merged
vanandrew merged 4 commits into
mainfrom
test/3.14-free-threaded
May 11, 2026
Merged

✨ enable free-threaded Python 3.14t support#23
vanandrew merged 4 commits into
mainfrom
test/3.14-free-threaded

Conversation

@vanandrew

@vanandrew vanandrew commented Apr 26, 2026

Copy link
Copy Markdown
Owner

Summary

Enables free-threaded (no-GIL) Python 3.14t wheels alongside the standard build matrix, while preserving Ctrl+C interruptibility on regular GIL builds.

Changes

  • build.yml: Split cp314* glob into cp314-* (standard) and cp314t* (free-threaded) matrix entries, so each is reported as its own job.
  • pyproject.toml: [tool.cibuildwheel].skip now only excludes *musllinux*; cp314t-* is built on every supported OS.
  • src/warpkit.cpp: Declared py::mod_gil_not_used() on the module (pybind11 3.0+ syntax) so CPython does not re-enable the GIL when the extension loads under a free-threaded interpreter.
  • include/warps.h: Wrapped every PyErr_CheckSignals() site in a new WARPKIT_CHECK_SIGNALS() macro that compiles to a no-op when Py_GIL_DISABLED is defined. GIL builds keep Ctrl+C interruptibility during long ITK operations; the free-threaded build skips the GIL-requiring check.
  • CLAUDE.md: Documents the macro and the updated wheel matrix.

Test plan

  • All 15 wheel jobs green (3.11 / 3.12 / 3.13 / 3.14 / 3.14t × ubuntu-latest / ubuntu-24.04-arm / macos-latest)
  • PyInstaller bundles green on linux-x86_64, linux-aarch64, macos-arm64
  • Docker linux/amd64 + linux/arm64 builds green
  • codecov patch + project pass
  • Local uv run pytest -q (210 passed), uvx ruff check, uvx ruff format --check, uvx pyright clean

@codecov

codecov Bot commented Apr 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.71%. Comparing base (0a5377f) to head (16845c9).

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #23   +/-   ##
=======================================
  Coverage   94.71%   94.71%           
=======================================
  Files          16       16           
  Lines        1249     1249           
=======================================
  Hits         1183     1183           
  Misses         66       66           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Remove PyErr_CheckSignals() calls from include/warps.h to support no-GIL execution.
This tradeoff loses Ctrl+C interruptibility during long ITK operations but enables
the pybind11 module to run safely without the GIL.

- Use PYBIND11_MODULE_GIL_NOT_USED() in src/warpkit.cpp
- Remove all 12 PyErr_CheckSignals() calls from include/warps.h
- Update pyproject.toml [tool.cibuildwheel] to allow cp314t-* builds
- Update CLAUDE.md CI section to reflect free-threaded support
Reintroduce PyErr_CheckSignals() in include/warps.h behind a
WARPKIT_CHECK_SIGNALS() macro that compiles to a no-op when Py_GIL_DISABLED
is defined. GIL builds regain Ctrl+C interruptibility during long ITK
operations; the free-threaded build still skips the GIL-requiring check.
@vanandrew vanandrew marked this pull request as ready for review May 11, 2026 01:39
Copilot AI review requested due to automatic review settings May 11, 2026 01:39

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds CI coverage for Python 3.14 free-threaded (“no-GIL”) builds by splitting the wheel build matrix into standard cp314-* and free-threaded cp314t*, and updating the extension code/config to better tolerate no-GIL builds.

Changes:

  • Update GitHub Actions wheel matrix to build/test both cp314-* and cp314t* wheels.
  • Enable cp314t-* builds in cibuildwheel by removing them from the skip list.
  • Adjust the C++ extension for free-threaded builds by declaring py::mod_gil_not_used() and guarding PyErr_CheckSignals() behind a macro that becomes a no-op under Py_GIL_DISABLED.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/warpkit.cpp Declares the module as mod_gil_not_used() to opt into free-threaded behavior.
include/warps.h Introduces WARPKIT_CHECK_SIGNALS() to avoid PyErr_CheckSignals() under Py_GIL_DISABLED.
pyproject.toml Removes cp314t-* from cibuildwheel’s skip list so free-threaded wheels can build.
.github/workflows/build.yml Splits Python 3.14 builds into cp314-* and cp314t* matrix entries.
CLAUDE.md Updates CI documentation to reflect free-threaded wheel support and the new signal-check behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/warpkit.cpp
@vanandrew vanandrew changed the title :test: add 3.14t free-threaded wheel build ✨ enable free-threaded Python 3.14t support May 11, 2026
@vanandrew vanandrew merged commit f30516a into main May 11, 2026
31 checks passed
@vanandrew vanandrew deleted the test/3.14-free-threaded branch May 11, 2026 01:50
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.

2 participants