Skip to main content

Core functionality for Pydantic validation and serialization

Reason this release was yanked:

incomplete wheels

Project description

pydantic-core

CI Coverage pypi versions license

This package provides the core functionality for pydantic validation and serialization.

Pydantic-core is currently around 17x faster than pydantic V1. See tests/benchmarks/ for details.

Example of direct usage

NOTE: You should not need to use pydantic-core directly; instead, use pydantic, which in turn uses pydantic-core.

from pydantic_core import SchemaValidator, ValidationError


v = SchemaValidator(
    {
        'type': 'typed-dict',
        'fields': {
            'name': {
                'type': 'typed-dict-field',
                'schema': {
                    'type': 'str',
                },
            },
            'age': {
                'type': 'typed-dict-field',
                'schema': {
                    'type': 'int',
                    'ge': 18,
                },
            },
            'is_developer': {
                'type': 'typed-dict-field',
                'schema': {
                    'type': 'default',
                    'schema': {'type': 'bool'},
                    'default': True,
                },
            },
        },
    }
)

r1 = v.validate_python({'name': 'Samuel', 'age': 35})
assert r1 == {'name': 'Samuel', 'age': 35, 'is_developer': True}

# pydantic-core can also validate JSON directly
r2 = v.validate_json('{"name": "Samuel", "age": 35}')
assert r1 == r2

try:
    v.validate_python({'name': 'Samuel', 'age': 11})
except ValidationError as e:
    print(e)
    """
    1 validation error for model
    age
      Input should be greater than or equal to 18
      [type=greater_than_equal, context={ge: 18}, input_value=11, input_type=int]
    """

Getting Started

Prerequisites

You'll need:

  1. Rust - Rust stable (or nightly for coverage)
  2. uv - Fast Python package manager (will install Python 3.9+ automatically)
  3. git - For version control
  4. make - For running development commands (or use nmake on Windows)

Quick Start

# Clone the repository (or from your fork)
git clone git@github.com:pydantic/pydantic-core.git
cd pydantic-core

# Install all dependencies using uv, setup pre-commit hooks, and build the development version
make install

Verify your installation by running:

make

This runs a full development cycle: formatting, building, linting, and testing

Development Commands

Run make help to see all available commands, or use these common ones:

make build-dev    # to build the package during development
make build-prod   # to perform an optimised build for benchmarking
make test         # to run the tests
make testcov      # to run the tests and generate a coverage report
make lint         # to run the linter
make format       # to format python and rust code
make all          # to run to run build-dev + format + lint + test

Useful Resources

Profiling

It's possible to profile the code using the flamegraph utility from flamegraph-rs. (Tested on Linux.) You can install this with cargo install flamegraph.

Run make build-profiling to install a release build with debugging symbols included (needed for profiling).

Once that is built, you can profile pytest benchmarks with (e.g.):

flamegraph -- pytest tests/benchmarks/test_micro_benchmarks.py -k test_list_of_ints_core_py --benchmark-enable

The flamegraph command will produce an interactive SVG at flamegraph.svg.

Releasing

TBC (needs to be integrated into pydantic repository release process).

Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pydantic_core-2.44.0-pp311-pypy311_pp73-musllinux_1_1_x86_64.whl (2.4 MB view details)

Uploaded PyPymusllinux: musl 1.1+ x86-64

pydantic_core-2.44.0-cp314-cp314t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (2.0 MB view details)

Uploaded CPython 3.14tmanylinux: glibc 2.17+ ARM64

pydantic_core-2.44.0-cp314-cp314-musllinux_1_1_aarch64.whl (2.2 MB view details)

Uploaded CPython 3.14musllinux: musl 1.1+ ARM64

pydantic_core-2.44.0-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.1 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.17+ x86-64

pydantic_core-2.44.0-cp313-cp313-win32.whl (2.0 MB view details)

Uploaded CPython 3.13Windows x86

pydantic_core-2.44.0-cp312-cp312-manylinux_2_31_riscv64.whl (2.2 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.31+ riscv64

pydantic_core-2.44.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.1 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

pydantic_core-2.44.0-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (2.2 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ ppc64le

pydantic_core-2.44.0-cp39-cp39-win_amd64.whl (2.1 MB view details)

Uploaded CPython 3.9Windows x86-64

pydantic_core-2.44.0-cp39-cp39-manylinux_2_31_riscv64.whl (2.2 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.31+ riscv64

File details

Details for the file pydantic_core-2.44.0-pp311-pypy311_pp73-musllinux_1_1_x86_64.whl.

File metadata

  • Download URL: pydantic_core-2.44.0-pp311-pypy311_pp73-musllinux_1_1_x86_64.whl
  • Upload date:
  • Size: 2.4 MB
  • Tags: PyPy, musllinux: musl 1.1+ x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.2 {"installer":{"name":"uv","version":"0.11.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for pydantic_core-2.44.0-pp311-pypy311_pp73-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 797ef27737969bdd0bf858dd72b30319bcdabd556a8bda3b4e0d2fe8aa701705
MD5 3124637c2308483efdbae325967acffb
BLAKE2b-256 1975b4f23dd21390d8056a91523ec4e59ecf3a86ce9f1e1cb0a3eb551ed33d1b

See more details on using hashes here.

File details

Details for the file pydantic_core-2.44.0-cp314-cp314t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

  • Download URL: pydantic_core-2.44.0-cp314-cp314t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
  • Upload date:
  • Size: 2.0 MB
  • Tags: CPython 3.14t, manylinux: glibc 2.17+ ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.2 {"installer":{"name":"uv","version":"0.11.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for pydantic_core-2.44.0-cp314-cp314t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 0d8686f928759c43ed383465248543808ff96332792b06a26d34cc880296806d
MD5 0b471b52137cf48e8dcfa70334af4064
BLAKE2b-256 00f8d9659f5a91fc1efad35a7fda2ce1e15dafb031dedd588bbdff170dd35d99

See more details on using hashes here.

File details

Details for the file pydantic_core-2.44.0-cp314-cp314-musllinux_1_1_aarch64.whl.

File metadata

  • Download URL: pydantic_core-2.44.0-cp314-cp314-musllinux_1_1_aarch64.whl
  • Upload date:
  • Size: 2.2 MB
  • Tags: CPython 3.14, musllinux: musl 1.1+ ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.2 {"installer":{"name":"uv","version":"0.11.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for pydantic_core-2.44.0-cp314-cp314-musllinux_1_1_aarch64.whl
Algorithm Hash digest
SHA256 b271ef6eab003905448df59906c4bd9283d9101a6a948fb3b2e8276ce79fb357
MD5 bd205244a742f929896ee46493d758af
BLAKE2b-256 fbbdc2ab6182ab98944a860b0b2ce5b085fe49935f9c05c5c8466f6241718153

See more details on using hashes here.

File details

Details for the file pydantic_core-2.44.0-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

  • Download URL: pydantic_core-2.44.0-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
  • Upload date:
  • Size: 2.1 MB
  • Tags: CPython 3.14, manylinux: glibc 2.17+ x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.2 {"installer":{"name":"uv","version":"0.11.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for pydantic_core-2.44.0-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 10242afdf1ae2fd2a9e7f8f7cfabb4ff912a4ae3bb22172505b8b321d0df2ea9
MD5 6a68ff57e3147aff7de56b2d9391da24
BLAKE2b-256 130427d354fa5c67992e3f60fc49d635e94d8ba5c80368c5ecc9f7b2c91d8f67

See more details on using hashes here.

File details

Details for the file pydantic_core-2.44.0-cp313-cp313-win32.whl.

File metadata

  • Download URL: pydantic_core-2.44.0-cp313-cp313-win32.whl
  • Upload date:
  • Size: 2.0 MB
  • Tags: CPython 3.13, Windows x86
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.2 {"installer":{"name":"uv","version":"0.11.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for pydantic_core-2.44.0-cp313-cp313-win32.whl
Algorithm Hash digest
SHA256 1e5d37838ebe645891ae419da3f570a39050b14313cd158d21b1e9d7f13d88a9
MD5 9e96c66cd28df0b3e67694b095e88d9c
BLAKE2b-256 278bb9a6c77154bd20a84ee372033a638b50095295aacd4e106ed1c968df5b8f

See more details on using hashes here.

File details

Details for the file pydantic_core-2.44.0-cp312-cp312-manylinux_2_31_riscv64.whl.

File metadata

  • Download URL: pydantic_core-2.44.0-cp312-cp312-manylinux_2_31_riscv64.whl
  • Upload date:
  • Size: 2.2 MB
  • Tags: CPython 3.12, manylinux: glibc 2.31+ riscv64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.2 {"installer":{"name":"uv","version":"0.11.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for pydantic_core-2.44.0-cp312-cp312-manylinux_2_31_riscv64.whl
Algorithm Hash digest
SHA256 ed0c6f8824428963b00fef947189d1d791709c80a8dd60be81a89b8cb41d3cf2
MD5 bddf19024511cf719fe8939695941234
BLAKE2b-256 b39b32716cce93f2ba12d4c3c734f3cac5ac9d6491ebdcdb3b029acbf52bf65f

See more details on using hashes here.

File details

Details for the file pydantic_core-2.44.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

  • Download URL: pydantic_core-2.44.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
  • Upload date:
  • Size: 2.1 MB
  • Tags: CPython 3.12, manylinux: glibc 2.17+ x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.2 {"installer":{"name":"uv","version":"0.11.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for pydantic_core-2.44.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b1dc950cde816ae047f097d08ef5d521a20ff0d2553c5e377cadb724fd9ce55b
MD5 45575b2c0860a3d1b7f667f50628d582
BLAKE2b-256 631214e262f25904ed3221190bdd72aebdbf0f20fba1b33ed61748fb9d85b553

See more details on using hashes here.

File details

Details for the file pydantic_core-2.44.0-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl.

File metadata

  • Download URL: pydantic_core-2.44.0-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
  • Upload date:
  • Size: 2.2 MB
  • Tags: CPython 3.11, manylinux: glibc 2.17+ ppc64le
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.2 {"installer":{"name":"uv","version":"0.11.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for pydantic_core-2.44.0-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 f64be97d095d4e2396764e49cce23ce8fb35003e8da076fa27072d4a20938179
MD5 84efcca9febbee87922bd63eafb0572c
BLAKE2b-256 9bf8a6eabdd3ea1b012942c242616cce97f89589c70adc8358f149d804352a13

See more details on using hashes here.

File details

Details for the file pydantic_core-2.44.0-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: pydantic_core-2.44.0-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 2.1 MB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.2 {"installer":{"name":"uv","version":"0.11.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for pydantic_core-2.44.0-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 51260acfc7ef0655ed508321f5a19420acdc727ef5890f76f98197cb50db6db5
MD5 8d2b044138c156fe8504e28bfc1259a6
BLAKE2b-256 b1caddccc63e764e33240b996989301d1285a04fdf8e6ec8ab03aef1e507b867

See more details on using hashes here.

File details

Details for the file pydantic_core-2.44.0-cp39-cp39-manylinux_2_31_riscv64.whl.

File metadata

  • Download URL: pydantic_core-2.44.0-cp39-cp39-manylinux_2_31_riscv64.whl
  • Upload date:
  • Size: 2.2 MB
  • Tags: CPython 3.9, manylinux: glibc 2.31+ riscv64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.2 {"installer":{"name":"uv","version":"0.11.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for pydantic_core-2.44.0-cp39-cp39-manylinux_2_31_riscv64.whl
Algorithm Hash digest
SHA256 557a5f41600854c094283140bc878900dab332d8968c70d9df80fa07a71d1422
MD5 4b687ae3398415a8c37644df2b2c0595
BLAKE2b-256 437114628fa4bf829506b454e8e88beea0820b4dc907a06ec8900f0bb72622e3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page