Type safe data validation using Pydantic v2
summary
Pydantic v2 replaces V1’s root-model hacks with TypeAdapter to build parsers/serializers for arbitrary Python types, adds support for Annotated (PEP 593) and TypeAliasType so type checkers and validators share metadata, and exposes validators that can conditionally call expensive functions. Internals compile an IR into Rust (a compiler-like Rust DAG), yielding much faster runtime validation but slower import/schema build times; JSON parsing can map floats to Decimal and recursive JSON schemas now work correctly.
AI-written summary · about
chapters (9)
- 0:00Introduction to Pydantic v2
- 1:07What changed in Pydantic v2
- 3:14Runtime validators in Pydantic v2
- 4:18Pydantic v2 and type system interaction
- 7:07Type aliases and recursive types
- 8:53Type checkers and annotated types
- 9:56Remaining pain points in Pydantic v2
- 12:26Pydantic v2 internals and Rust
- 18:05Recommendations for Rust extensions
