$ the-wire · showcase
Pydantic Core Is Poised For A Speed Leap
By RepoJournal · Filed · About FastAPI & Pydantic
Pydantic is moving its schema gathering logic into Rust, and the performance payoff is about to get real.
Pydantic's maintainers are pushing hard on performance: a rewrite of `FieldInfo` construction avoids repeated dict comprehensions [1], while a bigger move ports schema gathering to `pydantic-core` as "a quick win for performance" [2]. That Rust port is the one to watch, and it pairs with CI switching to maturin's `--pgo` option for profile-guided optimization [3]. The new-model work sets you up for a faster Pydantic 2.x line, but the whole effort hinges on PyO3 fixes that haven't shipped yet. Meanwhile, the platform adds `frozendict` as a first-class type [4] and lets `defaultdict` factories be `dict`, `frozendict`, or `frozenset` [5]. On the SQLModel side, a Typer floor bump to 0.26.1 [6] clears deprecation warnings that would break under Click 9.0, and the release notes are updated [7] to match [8].
Action items
- → Review the pydantic-core schema gathering PR and comment on the design pydantic/pydantic [plan]
- → Watch for frozendict support landing in a future Pydantic release pydantic/pydantic [monitor]
- → Plan to bump Typer minimum to 0.26.1 to avoid Click 9.0 breakage tiangolo/sqlmodel [plan]
References
- [1] Improve permormance of `FieldInfo` construction ↗ pydantic/pydantic
- [2] Move schema gathering logic to `pydantic-core` ↗ pydantic/pydantic
- [3] Use maturin `--pgo` option ↗ pydantic/pydantic
- [4] Add support for `frozendict` type ↗ pydantic/pydantic
- [5] Allow `dict`, `frozendict` and `frozenset` as `defaultdict` default factories ↗ pydantic/pydantic
- [6] ⬆️ Bump Typer min version to `0.26.1` ↗ tiangolo/sqlmodel
- [7] 📝 Update release notes tiangolo/sqlmodel
- [8] ⬆️ Bump Typer min version to `0.26.1` (#2078) tiangolo/sqlmodel