Skip to content

Python free-threading support #7342

@frankie567

Description

@frankie567

Now that free-threading (aka no-GIL) is a thing in Python 3.14, it could be interesting to explore if we can migrate to that. Not sure what kind of performance gain we could get, but it's worth to check.

The main blockers right now are libraries with C extensions that have not been adapted yet to this new mode.

Dependency blockers

  1. sqlalchemy (ready, to release in 2.1): Implement support for free-threaded Python sqlalchemy/sqlalchemy#12881
  2. asyncpg: Add Python 3.14 support, experimental subinterpreter/freethreading support MagicStack/asyncpg#1279
  3. httptools (dependency of Uvicorn): Support for free-threaded Python MagicStack/httptools#118

Experiments

2025-10-18

Tried to run the API with:

Server is starting, can serve a few requests, but then blocks and doesn't answer new requests. Probably a concurrency problem with greenlet.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions