Port variant | v13 |
Summary | Core module for pydantic (3.13) |
BROKEN | |
Package version | 2.25.0 |
Homepage | https://github.com/pydantic/pydantic-core |
Keywords | python, rust |
Maintainer | Python Automaton |
License | Not yet specified |
Other variants | v12 |
Ravenports | Buildsheet | History |
Ravensource | Port Directory | History |
Last modified | 11 NOV 2024, 23:28:05 UTC |
Port created | 05 MAR 2024, 06:30:48 UTC |
single | # 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._ ```py 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 You'll need rust stable [installed], or rust nightly if you want to generate accurate coverage. With rust and python 3.8+ installed, compiling pydantic-core should be possible with roughly the following: ```bash # clone this repo or your fork git clone git@github.com:pydantic/pydantic-core.git cd pydantic-core # create a new virtual env python3 -m venv env source env/bin/activate # install dependencies and install pydantic-core make install ``` That should be it, the example shown above should now run. You might find it useful to look at [`python/pydantic_core/_pydantic_core.pyi`] and [`python/pydantic_core/core_schema.py`] for more information on the python API, beyond that, [`tests/`] provide a large number of examples of usage. If you want to contribute to pydantic-core, you'll want to use some other make commands: |
Build (only) |
python-maturin:single:v13 python-pip:single:v13 python-typing-extensions:single:v13 rust:single:std python313:dev:std autoselect-python:single:std |
Build and Runtime | python313:primary:std |
Runtime (only) | ravensys-gcc:libs:std (single subpackage) |
main | mirror://PYPI/p/pydantic-core |
cr01 | mirror://CRATES/ahash:0.8.11 |
cr02 | mirror://CRATES/aho-corasick:1.1.3 |
cr03 | mirror://CRATES/autocfg:1.3.0 |
cr04 | mirror://CRATES/base64:0.22.1 |
cr05 | mirror://CRATES/bitvec:1.0.1 |
cr06 | mirror://CRATES/cc:1.0.101 |
cr07 | mirror://CRATES/cfg-if:1.0.0 |
cr08 | mirror://CRATES/displaydoc:0.2.5 |
cr09 | mirror://CRATES/enum_dispatch:0.3.13 |
cr10 | mirror://CRATES/equivalent:1.0.1 |
cr11 | mirror://CRATES/form_urlencoded:1.2.1 |
cr12 | mirror://CRATES/funty:2.0.0 |
cr13 | mirror://CRATES/getrandom:0.2.15 |
cr14 | mirror://CRATES/hashbrown:0.14.5 |
cr15 | mirror://CRATES/heck:0.5.0 |
cr16 | mirror://CRATES/hex:0.4.3 |
cr17 | mirror://CRATES/icu_collections:1.5.0 |
cr18 | mirror://CRATES/icu_locid:1.5.0 |
cr19 | mirror://CRATES/icu_locid_transform:1.5.0 |
cr20 | mirror://CRATES/icu_locid_transform_data:1.5.0 |
cr21 | mirror://CRATES/icu_normalizer:1.5.0 |
cr22 | mirror://CRATES/icu_normalizer_data:1.5.0 |
cr23 | mirror://CRATES/icu_properties:1.5.1 |
cr24 | mirror://CRATES/icu_properties_data:1.5.0 |
cr25 | mirror://CRATES/icu_provider:1.5.0 |
cr26 | mirror://CRATES/icu_provider_macros:1.5.0 |
cr27 | mirror://CRATES/idna:0.5.0 |
cr28 | mirror://CRATES/idna:1.0.2 |
cr29 | mirror://CRATES/indexmap:2.2.6 |
cr30 | mirror://CRATES/indoc:2.0.5 |
cr31 | mirror://CRATES/itoa:1.0.11 |
cr32 | mirror://CRATES/jiter:0.5.0 |
cr33 | mirror://CRATES/lexical-parse-float:0.8.5 |
cr34 | mirror://CRATES/lexical-parse-integer:0.8.6 |
cr35 | mirror://CRATES/lexical-util:0.8.5 |
cr36 | mirror://CRATES/libc:0.2.155 |
cr37 | mirror://CRATES/litemap:0.7.3 |
cr38 | mirror://CRATES/memchr:2.7.4 |
cr39 | mirror://CRATES/memoffset:0.9.1 |
cr40 | mirror://CRATES/num-bigint:0.4.6 |
cr41 | mirror://CRATES/num-integer:0.1.46 |
cr42 | mirror://CRATES/num-traits:0.2.19 |
cr43 | mirror://CRATES/once_cell:1.19.0 |
cr44 | mirror://CRATES/percent-encoding:2.3.1 |
cr45 | mirror://CRATES/portable-atomic:1.6.0 |
cr46 | mirror://CRATES/proc-macro2:1.0.86 |
cr47 | mirror://CRATES/pyo3:0.22.5 |
cr48 | mirror://CRATES/pyo3-build-config:0.22.5 |
cr49 | mirror://CRATES/pyo3-ffi:0.22.5 |
cr50 | mirror://CRATES/pyo3-macros:0.22.5 |
cr51 | mirror://CRATES/pyo3-macros-backend:0.22.5 |
cr52 | mirror://CRATES/python3-dll-a:0.2.10 |
cr53 | mirror://CRATES/quote:1.0.36 |
cr54 | mirror://CRATES/radium:0.7.0 |
cr55 | mirror://CRATES/regex:1.11.0 |
cr56 | mirror://CRATES/regex-automata:0.4.8 |
cr57 | mirror://CRATES/regex-syntax:0.8.5 |
cr58 | mirror://CRATES/rustversion:1.0.17 |
cr59 | mirror://CRATES/ryu:1.0.18 |
cr60 | mirror://CRATES/serde:1.0.213 |
cr61 | mirror://CRATES/serde_derive:1.0.213 |
cr62 | mirror://CRATES/serde_json:1.0.132 |
cr63 | mirror://CRATES/smallvec:1.13.2 |
cr64 | mirror://CRATES/speedate:0.14.4 |
cr65 | mirror://CRATES/stable_deref_trait:1.2.0 |
cr66 | mirror://CRATES/static_assertions:1.1.0 |
cr67 | mirror://CRATES/strum:0.26.3 |
cr68 | mirror://CRATES/strum_macros:0.26.4 |
cr69 | mirror://CRATES/syn:2.0.82 |
cr70 | mirror://CRATES/synstructure:0.13.1 |
cr71 | mirror://CRATES/tap:1.0.1 |
cr72 | mirror://CRATES/target-lexicon:0.12.14 |
cr73 | mirror://CRATES/tinystr:0.7.6 |
cr74 | mirror://CRATES/tinyvec:1.6.1 |
cr75 | mirror://CRATES/tinyvec_macros:0.1.1 |
cr76 | mirror://CRATES/unicode-bidi:0.3.15 |
cr77 | mirror://CRATES/unicode-ident:1.0.12 |
cr78 | mirror://CRATES/unicode-normalization:0.1.23 |
cr79 | mirror://CRATES/unindent:0.2.3 |
cr80 | mirror://CRATES/url:2.5.2 |
cr81 | mirror://CRATES/utf16_iter:1.0.5 |
cr82 | mirror://CRATES/utf8_iter:1.0.4 |
cr83 | mirror://CRATES/uuid:1.11.0 |
cr84 | mirror://CRATES/version_check:0.9.5 |
cr85 | mirror://CRATES/wasi:0.11.0+wasi-snapshot-preview1 |
cr86 | mirror://CRATES/write16:1.0.0 |
cr87 | mirror://CRATES/writeable:0.5.5 |
cr88 | mirror://CRATES/wyz:0.5.1 |
cr89 | mirror://CRATES/yoke:0.7.4 |
cr90 | mirror://CRATES/yoke-derive:0.7.4 |
cr91 | mirror://CRATES/zerocopy:0.7.34 |
cr92 | mirror://CRATES/zerocopy-derive:0.7.34 |
cr93 | mirror://CRATES/zerofrom:0.1.4 |
cr94 | mirror://CRATES/zerofrom-derive:0.1.4 |
cr95 | mirror://CRATES/zerovec:0.10.4 |
cr96 | mirror://CRATES/zerovec-derive:0.10.3 |
python-pydantic:v13 | Data validation using Python type hints (3.13) |