CodeVetter
← All unpacks
CodeVetter · Repo Unpack evidence

pydantic/pydantic

Scanned commit 29933d1c8c dated 2026-10-01 — last upstream commit. Generated by codevetter 1.15.0 on 2026-10-02.

github.com/pydantic/pydantic ↗ · 791 files · 8.7 MB

Pydantic Validation Data validation using Python type hints.

Deep analysis by cli:codex via the codex CLI on 2026-10-02 (427s) — every claim below links to its cited source files. Source inspection; upstream code and tests were not executed.

Overview

Pydantic is a Python library for developers who need to validate application data against type annotations and serialize the resulting objects. At commit 29933d1c8cfc882a7640f4d831b09381b39aa311, Python handles model construction, annotation resolution, customization, and JSON Schema generation, while a bundled Rust/PyO3 package executes validation and serialization. Its public surfaces include BaseModel, TypeAdapter, validated dataclasses, function-call validation, specialized types, and validation instrumentation plugins.

System map

This checkout is a library workspace with Python and native-extension boundaries. The Python package constructs schemas and exposes developer APIs; pydantic-core compiles schema descriptions into Rust validator and serializer objects. Model state belongs to Python instances, while compiled schemas belong to classes or adapters. Packaging, documentation publication, and ecosystem checks are handled by repository tooling and GitHub Actions.

Feature catalog

User-facing functionality is exposed through Python APIs rather than application routes or screens. BaseModel and TypeAdapter cover structured and arbitrary typed data, with dedicated wrappers for dataclasses and function calls. Field metadata, custom validators, serializers, and specialized types refine those contracts. JSON Schema export and instrumentation plugins support integration with surrounding developer systems.

Data flow

Type declarations first become field metadata, configuration, and executable core schemas. Validators and serializers retain those schemas while each validation call creates its own execution state. Input mode, aliases, context, and policy overrides travel into the Rust boundary. Results return as Python objects, structured errors, JSON bytes/strings, or JSON Schema dictionaries; persistence remains outside the main validation flow.

Behavior traces

The source traces cover model definition and instantiation, JSON validation and serialization, and validated function invocation end-to-end. They also follow adapter initialization, JSON Schema export, plugin callbacks, and state restoration. Each sequence describes implementation order and material branches rather than an observed execution. Deferred schemas and optional return validation change when parts of these sequences run.

Testing signals

Tests and CI were inspected, not executed; test existence establishes intended coverage, not passing results. The inspected suites use pytest, with separate native-core, documentation, plugin-installation, and static-type integration checks. CI defines platform and interpreter matrices, benchmarks, and downstream compatibility jobs. This inventory is bounded and does not establish exhaustive coverage or current coverage percentages.

Risk map

These are source-observed trust boundaries and maintenance hazards, not confirmed vulnerabilities. Validation can intentionally execute application callbacks, resolve annotations, import modules, and load installed plugins. Legacy parsing and filesystem types expose explicit file/input boundaries beyond ordinary in-memory validation. Cross-language schema contracts, cached validators, and output policy have broad effects across public APIs.

Extension points

Most application extensions attach to public schema hooks, Annotated metadata, decorators, factories, or plugin protocols. JSON Schema generation offers an explicit generator subclass boundary separate from executable-schema generation. Installed validation plugins wrap three input methods without replacing the underlying Rust validator. Adding a native schema kind requires coordination with fixed dispatch and schema definitions.

Contributor handoff

Start from the schema boundary and trace the specific public API before changing shared internals. Tests and CI were inspected, not executed, so future implementation work must establish its own validation results. The investigation covered selected source, tests, configuration, and every listed workflow entrypoint, but remains a bounded inventory. Keep version coupling, deferred construction, output types, and validation bypasses explicit in acceptance criteria.

Languages

LanguageFilesShare of source
Python45372%
Rust14423%
Markdown102docs/config
YAML29docs/config
TOML193%
HTML5docs/config
JavaScript51%
Shell41%

Start reading here

Probable source entrypoint: pyproject.toml — inferred from the directory tree and manifest, not the upstream docs.

Source roots

pydantic/ (107 files)

Repository structure

Top-level pathFiles
pydantic-core/292
tests/229
docs/112
pydantic/107
.github/27
.hyperlint/4
release/4
.agents/1

Docs found: CONTRIBUTING.mdREADME.mddocs/api/aliases.mddocs/api/annotated_handlers.mddocs/api/base_model.mddocs/api/config.mddocs/api/dataclasses.mddocs/api/errors.mddocs/api/experimental.mddocs/api/fields.md

Package

pyproject.toml — pydantic, 5 declared dependencies.

emailtimezone#'tzdata;]

CI & config entrypoints

Structural health signals

Average score 6.3/10 across 96 analyzed source files; 64 hotspots surfaced.

These are deterministic review leads — size, churn, and structural signals — not proof of a bug in this project.

Recent history