Data validation using Python type hints https://pydantic.dev/docs/validation
  • Python 86%
  • Rust 13.8%
Find a file
dependabot[bot] fe726a9923
Bump actions/create-github-app-token from 3.2.0 to 3.4.0 (#14469)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-12-02 10:31:55 +01:00
.agents/skills/pydantic Fix typos, phrasing, and missing imports in SKILL.md (#13708) 2026-08-25 16:32:56 +00:00
.github Bump actions/create-github-app-token from 3.2.0 to 3.4.0 (#14469) 2026-12-02 10:31:55 +01:00
.hyperlint Update to yamlfmt 0.21, enforce single quote strings (#12678) 2026-01-09 07:10:14 +00:00
docs 👥 Update Pydantic People (#14460) 2026-12-01 14:57:07 +00:00
pydantic Fix quadratic behavior of to_snake() on long uppercase sequences (#14441) 2026-11-29 15:11:19 +00:00
pydantic-core Fix str() errors being swallowed when serializing Decimal and Fraction in JSON mode (#14440) 2026-11-29 16:05:18 +01:00
release Improve release script (#13982) 2026-10-11 19:40:11 +00:00
tests Fix str() errors being swallowed when serializing Decimal and Fraction in JSON mode (#14440) 2026-11-29 16:05:18 +01:00
.git-blame-ignore-revs Ignore some commits in git blame (#12517) 2025-11-11 11:23:16 +00:00
.gitignore Add JSON documents benchmarks (#13879) 2026-10-29 14:00:41 +00:00
.markdownlint.yaml Lint Markdown files using markdownlint (#11307) 2025-05-08 10:48:47 +02:00
.pre-commit-config.yaml Drop support for Python 3.10 (#14250) 2026-11-07 11:06:01 +01:00
.yamlfmt.yaml Update to yamlfmt 0.21, enforce single quote strings (#12678) 2026-01-09 07:10:14 +00:00
AGENTS.md Update contributing guidelines (#14067) 2026-10-26 20:45:15 +00:00
build-docs.sh Make uv automatically install pydantic-core on uv run (#12496) 2025-11-10 13:41:41 +00:00
CITATION.cff Drop support for Python 3.10 (#14250) 2026-11-07 11:06:01 +01:00
CONTRIBUTING.md Add AI policy, update contributing guidelines (#13225) 2026-06-04 10:51:18 +00:00
HISTORY.md Add changelog for 2.14.x patch releases (#14327) 2026-11-19 13:59:05 +00:00
LICENSE add "and individual contributors" to copyright 2023-05-28 20:34:43 +01:00
Makefile Remove unused test-examples make target (#14294) 2026-11-16 08:54:46 +00:00
mkdocs.yml Drop support for Python 3.10 (#14250) 2026-11-07 11:06:01 +01:00
pyproject.toml Drop support for Python 3.10 (#14250) 2026-11-07 11:06:01 +01:00
README.md Drop support for Python 3.10 (#14250) 2026-11-07 11:06:01 +01:00
SECURITY.md Fix broken anchor and outdated test paths in SECURITY.md and contributing guide (#14133) 2026-10-30 08:54:57 +01:00
uv.lock Bump filelock from 3.32.7 to 4.2.1 (#14439) 2026-11-29 15:07:13 +00:00

Pydantic Validation

CI Coverage pypi CondaForge downloads versions license Pydantic v2 llms.txt

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 🔥

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

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.