Skip to content

Conversation

@svlandeg
Copy link
Member

@svlandeg svlandeg commented Oct 14, 2025

The Python 3.14 tests started failing with the Pydantic v.2.12.1 release, because of the combination of #14168 and pydantic/pydantic#12367.

Basically we were importing Pydantic v1 functionality even when the user had (only) Pydantic v2 installed. This was done in #14168 to support more easy migration from v1 to v2 by allowing mixing versions within the same app.

Here, we prevent importing any v1 functionality by creating dummy classes for Python 3.14 / Pydantic 2.12.0 onwards, which drops support for v1 and emits a warning when importing v1 functionality.

TODO

  • fix coverage
  • check warning is still shown to users at some point, and not just swallowed by this code.

@github-actions github-actions bot added the docs Documentation about how to use FastAPI label Oct 14, 2025
@svlandeg svlandeg added feature New feature or request and removed docs Documentation about how to use FastAPI labels Oct 14, 2025
@svlandeg svlandeg added bug Something isn't working and removed feature New feature or request labels Oct 14, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Oct 14, 2025

📝 Docs preview

Last commit b7d4d4c at: https://ffdce6a4.fastapitiangolo.pages.dev

Modified Pages

@svlandeg svlandeg changed the title Test CI (WIP) 🐛 Fix Pydantic v1 compatibility for Python 3.14 and Pydantic 2.12.1 Oct 14, 2025
@svlandeg svlandeg self-assigned this Oct 14, 2025
Copy link
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 @svlandeg! 🙌

I checked and confirmed that on Python 3.14, if users try to use Pydantic v1 they still get a warning on their own code, but not on older versions. So we're good to go! 🚀

@tiangolo tiangolo changed the title 🐛 Fix Pydantic v1 compatibility for Python 3.14 and Pydantic 2.12.1 🐛 Fix internal Pydantic v1 compatibility (warnings) for Python 3.14 and Pydantic 2.12.1 Oct 20, 2025
@tiangolo tiangolo merged commit d8c691f into fastapi:master Oct 20, 2025
30 checks passed
@svlandeg svlandeg deleted the fix/ci branch October 20, 2025 12:23
@svlandeg svlandeg removed their assignment Oct 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants