mrkeyoor.com_
Wed 16 Sept 13:52 UTC
Dev Toolsevaluationupdated 16 Sept 2026

pydantic review

Pydantic turns Python type hints into runtime checks, parsed model objects, serialization, and JSON Schema. It is useful at API, configuration, and data-loading boundaries where outside input must become predictable Python values.

Verdict

Our Pydantic run installed 39 packages in 89 seconds, but the build and tests both failed in 2 seconds, so this source checkout is not a clean recommendation for contributors. Application teams should still shortlist Pydantic when typed models, parsing, and JSON Schema need to share one definition. Set coercion and extra-field behavior deliberately, and reproduce the repository test setup before sending changes upstream.

We ran it

Lab card: what happened when we ran pydanticScreenshot of pydantic (pydantic.dev/docs/validation)
Install✓ · 89s39 packages · 37 MB
Build✗ · 2s
Tests✗ · 2sran, no count parsed
Known vulns0(pip-audit)
Repo839 files~213,650 lines of source · 11.4 MB · 10 CI workflows · tests dir

Answers from our run

Does pydantic build from source?

Dependencies installed in 89 seconds (39 packages), and the build failed. We cloned commit 7b15a78 into a clean Debian container with 3 CPUs and no project-specific setup.

Do pydantic's tests pass?

The test command failed in our container, and its output did not report a pass or fail count.

Does pydantic have known vulnerabilities in its dependencies?

pip-audit found none in the dependency tree at the time of our run.

Who should not use pydantic?

Teams that require unchanged input verification but will not enable strict mode: Pydantic checks the resulting object and coerces values by default.

What are the alternatives to pydantic?

Marshmallow, msgspec, attrs. Our Pydantic run installed 39 packages in 89 seconds, but the build and tests both failed in 2 seconds, so this source checkout is not a clean recommendation for contributors.

Setup2/5Install passed, but build and test harness each failed in 2 seconds
Docs5/5Defaults, strict mode, serialization, and V1 migration are explicit
Community5/528,779 stars with same-day code and issue activity
Maturity5/5V2.13.5 is active, with a maintained V1 compatibility namespace

Who it’s for

Python teams that want validation rules beside normal type annotations.
API developers who need model parsing, serialization, and JSON Schema from one definition.
Applications that benefit from converting common inputs such as numeric strings into typed values.
Pydantic V1 users who can migrate gradually through the bundled pydantic.v1 namespace.

Who it’s NOT for

Teams that require unchanged input verification but will not enable strict mode: Pydantic checks the resulting object and coerces values by default.
Security-sensitive boundaries that must reject every unknown field without a shared base configuration: extra fields are ignored by default.
Applications still pinned to Python 3.9 or older: the current project requires Python 3.10 or newer.
Large V1 codebases with no migration budget: V2 changes method names, equality, serialization, and other behavior, while the automated migration tool is still described as beta.
Pipelines that pass one-shot iterators into union fields without regression tests: open issue 8699 reports data loss after an earlier union branch consumes part of an iterator.

Setup reality

Our sandbox installed 39 packages in 89 seconds and used 37 MB. The build failed with exit 1 in 2 seconds. Tests then exited 4 in 2 seconds before collection because pytest rejected four configured benchmark arguments. Pip-audit found 0 known vulnerabilities.

Using the library needs Python 3.10 or newer, but no account, API credential, or service. You define a model and must decide whether inputs may be coerced, whether unknown fields are ignored, and where strict mode belongs.

The repository's dev dependency group lists pytest-benchmark, while its pytest configuration supplies the four rejected benchmark flags. Our log does not show why pytest failed to recognize them. V2 also has breaking changes from V1, though the package includes pydantic.v1 for staged migrations.

Pydantic validates the object it produces

Pydantic starts with an ordinary Python class that inherits from BaseModel. Type annotations become runtime parsing and validation rules, then the same model can return a dictionary, emit JSON, or generate JSON Schema. That makes it useful at the edge of an application, where request bodies, settings, database records, or imported files have to become values the rest of the program can trust.

The word validation needs care here. Pydantic promises that the resulting model matches its declared types, not that the input arrived in those types. Its own example turns the string '123' into the integer 123. That behavior is deliberate and often handy for HTTP parameters or environment variables. It matters more than the 11.4 MB size of the source checkout because it can change what your application accepts.

Default models coerce values and ignore extra keys

Lax conversion is the default. Strict mode can be enabled for one call, one field, or an entire model configuration. Even strict mode has differences between Python and JSON input for some types, so boundary tests should use the same input path as production. Unknown fields present another policy choice: by default, a model ignores them instead of returning an error. Set extra='forbid' when an unexpected key must fail.

A shared base model is the sensible place to make those choices consistent across a service. Without one, two endpoints can interpret the same payload differently because one model is strict and another is not. The installed environment in our sandbox was only 37 MB, but the adoption work is mainly semantic: test coercion, rejected values, aliases, unknown fields, and serialized output before replacing hand-written checks.

What happened when we ran it

Our sandbox installed 39 packages in 89 seconds, occupying 37 MB. The build command failed with exit code 1 after 2 seconds. The test command then failed with exit code 4 after 2 seconds, before pytest collected a test. Pip-audit reported 0 known vulnerabilities in the installed packages. Those results come from commit 7b15a78 in an unprivileged container with 3 CPUs and 8 GB of RAM.

The test log is specific about the immediate stop. Pytest did not recognize --benchmark-columns, --benchmark-group-by, --benchmark-warmup, or --benchmark-disable, all supplied by the repository configuration. The log does not say why those options were unavailable, so we cannot turn it into a claim about a missing package or broken test. No Pydantic assertion ran, and there is no pass or fail count to report.

The failed test command never reached Pydantic code

The pyproject file lists pytest-benchmark in the development dependency group and places the same four benchmark options in pytest's default arguments. That makes the mismatch reproducible enough to investigate, but the supplied tail stops at argument parsing. The separate build step also failed in 2 seconds, and the measurement block does not contain its error tail. Calling either failure a compiler bug would go beyond the evidence.

The checkout contained 839 files, about 213,650 source lines, and a real tests directory. It also had 10 CI workflow files and no Dockerfile. This is a mature library repository rather than a containerized service, so contributors should follow its documented environment setup and confirm the full suite locally. Our 39-package install was successful, yet it was not sufficient for the configured test command we ran.

V2 migration changes behavior as well as names

Pydantic V2 is a rewrite with breaking changes. The migration guide maps familiar methods such as dict(), json(), and parse_obj() to the newer model_dump(), model_dump_json(), and model_validate(). Equality rules changed, from_orm was deprecated, and nested subclass serialization now limits output to fields declared on the annotated type. A mechanical rename does not cover all of that.

The project offers two bridges. Pydantic V2 includes the V1 API under pydantic.v1, and bump-pydantic can transform source code, though the guide still calls that tool beta. The current package requires Python 3.10 or newer and pins pydantic-core 2.49.0. For a large V1 application, use the compatibility namespace first, then migrate behavior with tests instead of changing every import in one release.

Version 2.13.5 is active despite a large issue queue

Release 2.13.5 arrived on August 28, 2026 with fixes for validator reuse, garbage-collector traversal in pydantic-core, and smart-union field counting. GitHub recorded a push on September 16. We counted 541 open issues and 38 open pull requests, which explains the repository's combined count of 579 without pretending all 579 are defects. Issue discussions were also updated on September 16.

One open report, issue 8699, describes a V2.6 case where trying an iterator against the first branch of a union consumes values before the next branch runs. It was updated on September 16, but the report does not demonstrate the behavior on V2.13.5. Treat it as a reason to test one-shot iterators, not proof that every current union loses data. Our audit's 0 known vulnerabilities does not answer that correctness question.

Pydantic remains an easy library to justify for typed Python boundaries, provided your team chooses its input policy instead of inheriting the defaults by accident. The 89-second install was uneventful. The 2-second build and test failures were not. Application users can evaluate models now, while contributors should reproduce a passing development setup before relying on this checkout.

Alternatives

ProjectWhat it isPick it when
MarshmallowAn explicit schema library for loading and dumping Python data.pick this instead when separate schema classes fit your code better than model classes built around type hints.
msgspecTyped validation and serialization for JSON, MessagePack, YAML, and TOML.pick this instead when compact typed structures and several wire formats matter more than Pydantic's wider model API.
attrsA library for concise Python classes with converters and validators.pick this instead when you are modeling trusted in-process objects and do not need Pydantic's parsing or JSON Schema.

What people are saying

  1. [velocity-scout] pydantic/pydantic

Sources

  1. Pydantic README
  2. Pydantic repository facts
  3. Pydantic 2.13.5 release
  4. Pydantic models documentation
  5. Pydantic strict mode documentation
  6. Pydantic V2 migration guide
  7. Iterator union data-loss report

More dev tools reviews

crystal · IKONA-Security · noty · forward-implementation-first · breakscale · black · the whole board →