Skip to content

⬆️ Support free-threaded Python 3.14t#15149

Merged
tiangolo merged 31 commits intofastapi:masterfrom
svlandeg:feat/314t
Apr 16, 2026
Merged

⬆️ Support free-threaded Python 3.14t#15149
tiangolo merged 31 commits intofastapi:masterfrom
svlandeg:feat/314t

Conversation

@svlandeg
Copy link
Copy Markdown
Member

@svlandeg svlandeg commented Mar 18, 2026

Continues from #13946: adding support for free-threaded Python 3.14t

  • Extend test suite with a configuration for python-version: "3.14t"
  • Allow the test suite to run when orjson and/or ujson is not installed, cf also 🗑️ Deprecate ORJSONResponse and UJSONResponse #14964 which deprecated ORJSONResponse & UJSONResponse
  • Remove orjson & ujson as a standard test dependency
  • Add an additional test configuration to test for deprecated ujson/orjson tests (to ensure coverage goes back to 100%)
  • Ensure that fastar 0.9.0 is used

Checklist

Open question

Decided not to do this:

  • Bump pydantic-core & strawberry-graphql (and maybe others) to allow running uv-resolution: lowest-direct on 3.14t as well. This will negatively impact other users on older Python versions / older external lib versions.

@svlandeg svlandeg self-assigned this Mar 18, 2026
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Mar 18, 2026

Merging this PR will not alter performance

✅ 20 untouched benchmarks


Comparing svlandeg:feat/314t (4850599) with master (180e81b)1

Open in CodSpeed

Footnotes

  1. No successful run was found on master (c3c9dd6) during the generation of this report, so 180e81b was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@svlandeg svlandeg removed the internal label Mar 18, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 18, 2026

📝 Docs preview

Last commit 4850599 at: https://ff6f4152.fastapitiangolo.pages.dev

@ngoldbaum
Copy link
Copy Markdown

Thanks for picking this up again!

Comment thread fastapi/responses.py
ujson = None # type: ignore


class _OrjsonModule(Protocol):
Copy link
Copy Markdown
Member Author

@svlandeg svlandeg Mar 18, 2026

Choose a reason for hiding this comment

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

This is a bit convoluted to avoid type checker shenanigans, as they need to work with or without orjson in the env.

(and the same thing for ujson in this module)

@svlandeg
Copy link
Copy Markdown
Member Author

Hm, now stuck on fastar 😕

@ngoldbaum
Copy link
Copy Markdown

It looks like they need an update either to declare support for the free-threaded build or simply update to the latest PyO3 version, which does that automatically. I might poke at that today to help you out here.

@svlandeg
Copy link
Copy Markdown
Member Author

It looks like they need an update either to declare support for the free-threaded build or simply update to the latest PyO3 version, which does that automatically. I might poke at that today to help you out here.

That would be awesome, thank you so much!

@ngoldbaum
Copy link
Copy Markdown

I opened DoctorJohn/fastar#60.

@github-actions github-actions bot added the conflicts Automatically generated when a PR has a merge conflict label Mar 20, 2026
@github-actions

This comment was marked as resolved.

@github-actions github-actions bot removed the conflicts Automatically generated when a PR has a merge conflict label Mar 20, 2026
@ngoldbaum
Copy link
Copy Markdown

Looks like the Mac and Windows tests aren't picking up fastar 0.9.0.

@svlandeg svlandeg self-assigned this Mar 23, 2026
@svlandeg
Copy link
Copy Markdown
Member Author

Ok cool, confirmed that bumping to pydantic >= 2.12.0 and strawberry-graphql >= 0.284.0 allows the test suite to run succesfully with uv-resolution: lowest-direct on Python 3.14t.

Discussed this internally with Sebastián and decided that we don't want to go so far as bumping Pydantic to 2.12+, as it might create issues for users still on older versions. So, I'll remove this test configuration again and then this PR should be ready for review.

@svlandeg svlandeg marked this pull request as ready for review March 23, 2026 14:29
@svlandeg svlandeg assigned svlandeg and unassigned svlandeg Mar 23, 2026
@svlandeg svlandeg removed their assignment Mar 24, 2026
@github-actions

This comment was marked as resolved.

@github-actions github-actions bot added the conflicts Automatically generated when a PR has a merge conflict label Apr 1, 2026
@svlandeg svlandeg self-assigned this Apr 1, 2026
@github-actions github-actions bot removed the conflicts Automatically generated when a PR has a merge conflict label Apr 3, 2026
@svlandeg svlandeg removed their assignment Apr 3, 2026
Copy link
Copy Markdown
Member

@tiangolo tiangolo left a comment

Choose a reason for hiding this comment

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

Awesome, thank you! 🙌 🚀

@tiangolo tiangolo merged commit 4b26487 into fastapi:master Apr 16, 2026
43 checks passed
@svlandeg svlandeg deleted the feat/314t branch April 16, 2026 14:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants