Skip to content

Pydantic

Open source

Python data validation using type hints

Pydantic preview

About Pydantic

Pydantic is a Python library for validating and parsing data. It uses standard Python type hints to describe the shape of your data.

What it does

You define a model as a Python class with typed fields. When you create the model from input data, Pydantic checks each value and converts it where that is safe. If a value does not fit, it raises an error that names each invalid field. Models can also export their structure as JSON Schema, which helps with API documentation. Many web frameworks and data tools build on it.

Who it's for

Python developers who build web APIs, data pipelines or scripts that receive input from outside. Teams that want typed, self-documenting data structures will also find it useful. Anyone already using type hints can adopt it one model at a time.

Pricing and good to know

Pydantic is open source under the MIT license and free to use. It runs on any system that runs Python and installs with the standard Python package tools. Validation happens when a model is created, so each record you parse has a small cost, and reusing models is a good habit.

Highlights

  • Define models with Python type hints
  • Validate and convert input data
  • Report errors for each invalid field
  • Generate JSON Schema from models
  • Serialize models to dictionaries and JSON

Ratings & reviews

Rate Pydantic

Stars alone count straight away.0/300

Checking that you are human…

Was this page helpful?
Open source

Ajv

Fast JSON Schema validator for JavaScript

Database Development Tools
Open source

FastAPI

Python framework for building APIs with type hints and automatic docs

Backend Frameworks
Open source

JSON Schema

Standard vocabulary for describing and validating JSON data

API Development Tools
Open source

Valibot

Modular TypeScript schema library for validating unknown data

Database Development Tools
Open source

Zod

TypeScript-first schema validation with static type inference

API Development Tools
Open source

ArkType

TypeScript-style validators that check data at runtime

Database Development Tools
Open source

Joi

Schema description and validation library for JavaScript objects

API Development Tools
Open source

Pydantic AI

Type-safe Python agent framework with many model providers

Agent Frameworks
Open source

Litestar

Typed Python ASGI framework with automatic OpenAPI docs

Backend Frameworks
Open source

quicktype

Generates typed models from JSON, JSON Schema and GraphQL

Code Utilities
Open source

JSON Crack

Visualize JSON, YAML, CSV and XML as interactive graphs

Code Utilities
Open source

Fastify

Fast Node.js web framework with schema validation and plugins

Backend Frameworks