pydantic
Data validation using Python type hints
Decision gist · record as of 2026-08-14
Yes. Pydantic is actively maintained, has no known vulnerabilities, installs with low friction, and is licensed permissively. It is the de facto standard for runtime data validation in Python and is worth installing for any project that accepts or processes structured data.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.9 or later.
- Low install friction; pure Python wheel.
- Active maintenance with recent releases; requires Python 3.9 or later.
License · maintenance · safety
MIT (permissive) — MIT license permits commercial and private use with minimal restrictions; suitable for most projects.
last release 2026-05-06 (100 days)
0 known vulnerabilities (OSV.dev, 2026-08-14) · 1,105,778,495 downloads/mo, #21 on PyPI
Alternatives
Verify before relying
pip install pydantic
from pydantic import BaseModel
from datetime import datetime
from typing import Optional
class User(BaseModel):
id: int
name: str = 'John Doe'
signup_ts: Optional[datetime] = None
user = User(id='123', signup_ts='2017-06-01 12:22')
print(user.id, user.signup_ts)- Whether pydantic-core and annotated-types are compiled dependencies that may require build tools on some platforms.
- Performance characteristics compared to alternative validation libraries for large-scale or real-time use.
What it is and what it does
Pydantic is a data validation library that uses Python type hints to define and enforce data schemas at runtime. You declare a model by subclassing BaseModel and annotating fields with types; Pydantic then validates incoming data, coerces types where safe (e.g., string '123' to int 123), and raises validation errors when data doesn't match. It integrates with Python's type system and linters, making schemas readable and IDE-friendly.
The library handles common tasks like optional fields, defaults, nested models, and custom validators. It also generates JSON schemas from models and can serialize models back to JSON or Python dicts. Pydantic V2 (the current major version) is a rewrite offering performance improvements and new features; it includes a compatibility layer for V1 code. The package is widely used in web frameworks, API servers, configuration management, and anywhere structured data needs validation before processing.
Use it for
- Validate and coerce incoming JSON or form data in REST APIs before passing to business logic.
- Define configuration schemas and load settings from environment variables or config files with type safety.
- Ensure database models or ORM objects conform to expected structure before serialization or storage.
- Build CLI tools that accept and validate complex nested command-line arguments or config files.
- Generate OpenAPI/JSON Schema documentation automatically from Pydantic model definitions.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
Pydantic is actively maintained, has no known vulnerabilities, installs with low friction, and is licensed permissively. It is the de facto standard for runtime data validation in Python and is worth installing for any project that accepts or processes structured data.
Install
pydantic on PyPI
Before you install
Low install friction; pure Python wheel. Active maintenance with recent releases; requires Python 3.9 or later.
Requires Python 3.9 or later.
License in practice
MIT license permits commercial and private use with minimal restrictions; suitable for most projects.
Quickstart
pip install pydantic
from pydantic import BaseModel
from datetime import datetime
from typing import Optional
class User(BaseModel):
id: int
name: str = 'John Doe'
signup_ts: Optional[datetime] = None
user = User(id='123', signup_ts='2017-06-01 12:22')
print(user.id, user.signup_ts)
Verify before relying
- Whether pydantic-core and annotated-types are compiled dependencies that may require build tools on some platforms.
- Performance characteristics compared to alternative validation libraries for large-scale or real-time use.
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.9 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 4 packagesannotated-typespydantic-coretyping-extensionstyping-inspection |
| Maintenance | Actively maintained 100 days since the last release |
| First released | |
| Downloads | 1,105,778,495 / month, #21 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableFramework :: HypothesisFramework :: PydanticIntended Audience :: DevelopersIntended Audience :: Information TechnologyOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: InternetTopic :: Software Development :: Libraries :: Python Modules |
Evidence: pydantic-2.13.4-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
An agent finds packages by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language. Give your agent the search over MCP.
More Python Modules packages
Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.
Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.
Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.
PyYAML parses and emits YAML 1.1 data format, enabling serialization and deserialization of configuration files and Python objects to and from human-readable YAML text.
Provides reusable metadata objects for use with PEP-593 `typing.Annotated` to express common constraints like bounds, collection sizes, and predicates on types.
Install it if you use or build libraries that need to express type constraints in a standardized, inspectable way—or if you want to annotate your own types with…
Provides runtime tools to inspect and introspect Python type annotations, enabling programmatic examination of type hints at execution time.
Determines platform-specific directories for application data, config, cache, logs, and user media folders across macOS, Windows, Linux, and Android.
See also pydantic-ai · pydantic-function-models · pydantic-settings · pydantic_core · pydantic-factories · django-pydantic-field · jsonschema-pydantic-converter · pydantic_yaml · dydantic · pydantic-xml