Python reference

Pydantic & core
cheat sheet.

Pydantic models, validation, serialization, settings, and custom types, with direct pydantic-core examples.

44 topics60 code examplesUpdated
How Pydantic & core fits together
01Describe the shapePython types and field rules define accepted input.
02Validate the boundaryPydantic builds and runs a compiled core schema.
03Use typed valuesYour application works with checked Python objects.
04Control the outputSerialization defines the public data you expose.
Jump to a specific topic

Choose a chapter

5 chapters · 44 topics

CHAPTER 01 / 05

Models, fields, and types

Define models, fields, defaults, nested data, aliases, unions, and partial updates.

12 topics
CHAPTER 02 / 05

Validation and serialization

Write validation rules and serializers, protect sensitive output, and report structured errors.

9 topics
CHAPTER 05 / 05

Custom types and core schemas

Build custom types and core schemas, validate and serialize directly, and test data boundaries.

13 topics