Pydantic

Python data validation library that uses type hints to define and enforce schemas.

Liked for validating LLM structured output, catching malformed JSON for retries with helpful error messages,123 and for typed data models and DTOs in larger Python codebases.45 It suits Python developers who validate LLM output, scraped data, or JSON passed between services,67 though one commenter was still waiting for first-class support in the Ty type checker.8
The HN verdict, written from 8 cited comments
8recommend
0warn against
Nov 14, 2025first mention
Aug 29, 2026latest mention
Nov 25 – Oct 26
Used forfor LLM appsfor Python developersfor large codebasesfor JSON validationdata validationschema validation

Why people recommend it

LLM output validation · 3

Strict schemas catch malformed JSON from LLMs and give clear errors to retry with.

“We wrap tool calls in strict Pydantic schemas to catch and retry malformed JSON”

“you can add complex pydantic validators (or whatever, I use pydantic) with super helpful error messages”

Show 1 more

“an explicit enough_context flag via Instructor + Pydantic”

Typed data models · 2

Used as DTOs and typed models to bring type safety to larger Python projects.

“push all ORM work into repositories that return Pydantic DTOs”

“We use Pydantic heavily”

uses Pydantic heavily on large Python codebaseon “Announcing the Beta release of ty”

API design · 2

Credited with influential API design and with advancing the Python ecosystem.

“the hard work that the original designers of libraries like FastAPI, Zod, Pydantic, have invested”

“I see Astral and Pydantic as a league of their own in terms of advancing Python”

Data validation · 2

Validates JSON before it reaches the database and fits well with JSON Schema across stacks.

“JSON goes through Pydantic validation before it touches the database.”

“the support for JSON Schema is much better across the stacks I use, e.g. Zod in JS/TS, Pydantic in Python”

Fast iteration · 1

Changing validators is a quick edit and rerun, with no compile step.

“With Python or JS, this is a pydantic edit + run.”

Readability · 1

Seen as more restrained and readable than Zod.

Caveats and dissent

Ty support · 1

First-class support in the Ty type checker was still pending at the time.

“We use Pydantic heavily”

uses Pydantic heavily on large Python codebaseon “Announcing the Beta release of ty”

Often compared with

Who recommends it in their own words

All comments 11

“the support for JSON Schema is much better across the stacks I use, e.g. Zod in JS/TS, Pydantic in Python”

“an explicit enough_context flag via Instructor + Pydantic”

“With Python or JS, this is a pydantic edit + run.”

“push all ORM work into repositories that return Pydantic DTOs”

“the hard work that the original designers of libraries like FastAPI, Zod, Pydantic, have invested”

“JSON goes through Pydantic validation before it touches the database.”

“We use Pydantic heavily”

uses Pydantic heavily on large Python codebaseon “Announcing the Beta release of ty”

“We wrap tool calls in strict Pydantic schemas to catch and retry malformed JSON”

“I see Astral and Pydantic as a league of their own in terms of advancing Python”

“you can add complex pydantic validators (or whatever, I use pydantic) with super helpful error messages”

Threads where it came up

Also written as pydantic. Data: pydantic.json. Quotes are verbatim; the verdict and theme labels are written by a model from these comments, and every clause links to its sources.

Keyboard shortcuts
j / kNext / previous item
o or EnterOpen selected item
/Search
g hHome
g tTop
g rRising
g cCategories
tToggle dark mode
?This help