+16
Daily
+235
Weekly
+515
Monthly
29,513
stars
3,177
forks
183
watchers
5,936
prs
5,833
issues
207
releases
README
Pydantic Validation
Data validation using Python type hints.
Fast and extensible, Pydantic plays nicely with your linters/IDE/brain.
Define how data should be in pure, canonical Python 1+; validate it with Pydantic.
Pydantic Logfire :fire:
Logfire is an observability and evaluation platform for AI applications and agents. Debug and trace agent execution, evaluate AI outputs, and manage model interactions through an integrated AI gateway.
Explore Logfire’s AI observability and evaluation platform.
Pydantic V1.10 vs. V2
Pydantic V2 is a ground-up rewrite that offers many new features, performance improvements, and some breaking changes compared to Pydantic V1.
If you're using Pydantic V1 you may want to look at the
pydantic V1.10 Documentation or,
1.10.X-fixes git branch. Pydantic V2 also ships with the latest version of Pydantic V1 built in so that you can incrementally upgrade your code base and projects: from pydantic import v1 as pydantic_v1.
Help
See documentation for more details.
Installation
Install using pip install -U pydantic or conda install pydantic -c conda-forge.
For more installation options to make Pydantic even faster,
see the Install section in the documentation.
A Simple Example
python
from datetime import datetime
from typing import Optional
from pydantic import BaseModel
class User(BaseModel):
id: int
name: str = 'John Doe'
signup_ts: Optional[datetime] = None
friends: list[int] = []
external_data = {'id': '123', 'signup_ts': '2017-06-01 12:22', 'friends': [1, '2', b'3']}
user = User(external_data)
print(user)
User id=123 name='John Doe' signup_ts=datetime.datetime(2017, 6, 1, 12, 22) friends=[1, 2, 3]
print(user.id)
123
Contributing
For guidance on setting up a development environment and how to make a
contribution to Pydantic, see
Contributing to Pydantic.
Reporting a Security Vulnerability
See our security policy.Top issues
#8379More consistent and intuitive `alias` behavior for validation and serialization37 comments · 2023-12-15#7186AnyUrl adds trailing slash35 comments · 2023-08-21#8279Custom type adapters31 comments · 2023-12-01#7457Decimals are json-dumped as strings31 comments · 2023-09-15#9731Add support for `typing.Never`29 comments · 2024-06-22#7161JSON Schema for optional fields is incorrect.29 comments · 2023-08-17#5893Present Field Name Rather Than Alias When Using Intellisense29 comments · 2023-05-26#8271OpenAPI discriminator field disapeared with pydantic v2.528 comments · 2023-12-01
Discussions
#14252Matrix Globe — Pydantic proof bundles for executable agent code reviews0 comments · 2026-11-07#14190Binding MCP read-back receipts to expected IDs with ValidationInfo.context0 comments · 2026-11-02#14086Show and tell: sysflow-mcp — Real-time process telemetry, resource throttling & system metrics for agent runtimes0 comments · 2026-10-27#14078Shareable traces for validated field assignment and recovery0 comments · 2026-10-26#14045recall-pydantic-ai: long-term memory for Pydantic AI agents, with corrections2 comments · 2026-10-21#13910Pass value into PrivateAttr inside custom __init__1 comments · 2026-10-01#13839Windows CPython 3.13: intermittent access violation during nested model_dump — diagnostic guidance3 comments · 2026-09-20#13811Feat: Add fallback to default value on validation error in Field()1 comments · 2026-09-15
Latest release
v2.14.3 2026-11-04 v2.14.3 2026-11-05v2.14.3 (2026-11-04) What's Changed Packaging Build wheels for GraalPy 3.13 by @msimacek in 14136. The previous v2.14.2 release published GraalPy 3.11 wheels, which were not working due to a PyO3 version bump. A CI workflow issue made it so that the wheel wasn't tested before publishing. This is now fixed: starting in v2.14.3, we no longer publish GraalPy 3.11 wheels, and GraalPy 3.13 wheels are now published together with the existing 3.12 one. Performance Improve schema generation for fixed type handlers by @alexmojaki in 14130 Skip general schema dispatch for buil
News & coverage (16)
Hacker NewsMCP Run Python▲ 173 · 66 comments · 2025-04-15Hacker NewsJSON extra uses orjson instead of ujson (2019)▲ 69 · 16 comments · 2024-06-05Hacker NewsAgent Framework / shim to use Pydantic with LLMs▲ 7 · 3 comments · 2024-12-02Hacker NewsPydantic 2.0▲ 6 · 3 comments · 2023-06-30Hacker NewsPydantic 2 rewritten in Rust was merged▲ 4 · 2 comments · 2022-11-03Hacker NewsPydantic AI▲ 3 · 0 comments · 2024-12-03Hacker NewsPydanticAI using Ollama (llama3.2) running locally▲ 2 · 3 comments · 2024-12-06githubGitHub secret scanning — coverage update2026-03-31VentureBeatPython data validator Pydantic launches model-agnostic AI agent development platform2024-12-04TechCrunchSequoia backs Pydantic to expand beyond its open source data-validation framework2024-10-01