Free-threaded Python (3.14t) support#151
Merged
Merged
Conversation
Full-lane design change + a decision recording free-threading as a compatibility guarantee (runs on 3.14t, GIL off) rather than a parallelism redesign, and why 3.14t is the only target (deps ship cp314t wheels, no cp313t). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Local proof on 3.14t showed SQLAlchemy's Cython extensions re-enable the GIL (they ship cp314t wheels but don't declare Py_MOD_GIL_NOT_USED). Scope the guarantee to DISABLE_SQLALCHEMY_CEXT_RUNTIME=1 (SQLAlchemy's sanctioned switch); record a decision with a revisit trigger. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Adds a standalone `freethreaded` job that installs 3.14t, runs the full suite (--no-cov), and asserts sys._is_gil_enabled() is False so a dependency that silently re-enables the GIL fails the build. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Advertises the CI-proven 3.14t free-threaded compatibility on PyPI. Conservative first claim; bump to 3 - Stable after real-world soak. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
States what is guaranteed (runs on 3.14t, GIL off) and what is not (no extra in-process parallelism; the subscriber stays single-loop). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The suite's pytest step runs GIL-on (test tooling imports aiokafka at collection, which re-enables the GIL); only the standalone assertion step proves the outbox's runtime dependency graph keeps the GIL disabled. Word the docs/spec to reflect both facts instead of implying the suite runs GIL-off. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Benchmark gate✅ gate passed
Gated (fails the build): |
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.
Guarantees free-threaded (no-GIL) CPython 3.14t compatibility — a
compatibility guarantee, not a behavior change. No runtime/source change to the
package.
What lands
freethreadedCI job: installs 3.14t, runs the full suite(
--no-cov), and assertssys._is_gil_enabled() is Falsefor the outbox'sruntime dependency graph so a silent GIL re-enable turns the build red.
Programming Language :: Python :: Free Threading :: 2 - Betaclassifier.Notable finding baked into the design: SQLAlchemy's Cython extensions ship
cp314twheels but don't declare free-thread safety, so importing SQLAlchemyre-enables the GIL. The job sets
DISABLE_SQLALCHEMY_CEXT_RUNTIME=1(SQLAlchemy'sown switch); the docs tell users to do the same for a genuinely GIL-free process.
The suite itself runs GIL-on (test-only
aiokafkare-enables it at collection) —the docs state the two CI facts separately.
Design & rationale:
planning/changes/2026-07-18.01-free-threaded-support.mdDecisions:
planning/decisions/2026-07-18-free-threading-is-compat-only.md,planning/decisions/2026-07-18-sqlalchemy-cyext-disables-gil.mdFollow-up (repo admin): add
freethreadedto branch-protection required checks,as with the other
_checksjobs.🤖 Generated with Claude Code