diff options
Diffstat (limited to '.venv/lib/python3.12/site-packages/pydantic_core-2.27.2.dist-info')
5 files changed, 199 insertions, 0 deletions
diff --git a/.venv/lib/python3.12/site-packages/pydantic_core-2.27.2.dist-info/INSTALLER b/.venv/lib/python3.12/site-packages/pydantic_core-2.27.2.dist-info/INSTALLER new file mode 100644 index 00000000..a1b589e3 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/pydantic_core-2.27.2.dist-info/INSTALLER @@ -0,0 +1 @@ +pip diff --git a/.venv/lib/python3.12/site-packages/pydantic_core-2.27.2.dist-info/METADATA b/.venv/lib/python3.12/site-packages/pydantic_core-2.27.2.dist-info/METADATA new file mode 100644 index 00000000..9ec1534b --- /dev/null +++ b/.venv/lib/python3.12/site-packages/pydantic_core-2.27.2.dist-info/METADATA @@ -0,0 +1,161 @@ +Metadata-Version: 2.4 +Name: pydantic_core +Version: 2.27.2 +Classifier: Development Status :: 3 - Alpha +Classifier: Programming Language :: Python +Classifier: Programming Language :: Python :: 3 +Classifier: Programming Language :: Python :: 3 :: Only +Classifier: Programming Language :: Python :: 3.8 +Classifier: Programming Language :: Python :: 3.9 +Classifier: Programming Language :: Python :: 3.10 +Classifier: Programming Language :: Python :: 3.11 +Classifier: Programming Language :: Python :: 3.12 +Classifier: Programming Language :: Python :: 3.13 +Classifier: Programming Language :: Rust +Classifier: Framework :: Pydantic +Classifier: Intended Audience :: Developers +Classifier: Intended Audience :: Information Technology +Classifier: License :: OSI Approved :: MIT License +Classifier: Operating System :: POSIX :: Linux +Classifier: Operating System :: Microsoft :: Windows +Classifier: Operating System :: MacOS +Classifier: Typing :: Typed +Requires-Dist: typing-extensions >=4.6.0, !=4.7.0 +License-File: LICENSE +Summary: Core functionality for Pydantic validation and serialization +Home-Page: https://github.com/pydantic/pydantic-core +Author-email: Samuel Colvin <s@muelcolvin.com> +License: MIT +Requires-Python: >=3.8 +Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM +Project-URL: Homepage, https://github.com/pydantic/pydantic-core +Project-URL: Funding, https://github.com/sponsors/samuelcolvin +Project-URL: Source, https://github.com/pydantic/pydantic-core + +# pydantic-core + +[](https://github.com/pydantic/pydantic-core/actions?query=event%3Apush+branch%3Amain+workflow%3Aci) +[](https://codecov.io/gh/pydantic/pydantic-core) +[](https://pypi.python.org/pypi/pydantic-core) +[](https://github.com/pydantic/pydantic-core) +[](https://github.com/pydantic/pydantic-core/blob/main/LICENSE) + +This package provides the core functionality for [pydantic](https://docs.pydantic.dev) validation and serialization. + +Pydantic-core is currently around 17x faster than pydantic V1. +See [`tests/benchmarks/`](./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](https://rustup.rs/), 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`](./python/pydantic_core/_pydantic_core.pyi) and +[`python/pydantic_core/core_schema.py`](./python/pydantic_core/core_schema.py) for more information on the python API, +beyond that, [`tests/`](./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: +* `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` to run `format build-dev lint test` + +## Profiling + +It's possible to profile the code using the [`flamegraph` utility from `flamegraph-rs`](https://github.com/flamegraph-rs/flamegraph). (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.): + +```bash +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 + +1. Bump package version locally. Do not just edit `Cargo.toml` on Github, you need both `Cargo.toml` and `Cargo.lock` to be updated. +2. Make a PR for the version bump and merge it. +3. Go to https://github.com/pydantic/pydantic-core/releases and click "Draft a new release" +4. In the "Choose a tag" dropdown enter the new tag `v<the.new.version>` and select "Create new tag on publish" when the option appears. +5. Enter the release title in the form "v<the.new.version> <YYYY-MM-DD>" +6. Click Generate release notes button +7. Click Publish release +8. Go to https://github.com/pydantic/pydantic-core/actions and ensure that all build for release are done successfully. +9. Go to https://pypi.org/project/pydantic-core/ and ensure that the latest release is published. +10. Done 🎉 + diff --git a/.venv/lib/python3.12/site-packages/pydantic_core-2.27.2.dist-info/RECORD b/.venv/lib/python3.12/site-packages/pydantic_core-2.27.2.dist-info/RECORD new file mode 100644 index 00000000..d6df1889 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/pydantic_core-2.27.2.dist-info/RECORD @@ -0,0 +1,12 @@ +pydantic_core-2.27.2.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
+pydantic_core-2.27.2.dist-info/METADATA,sha256=rqlfxfbY-k1mucDj4GVjYjEcHQLbp3tKThiRYa_7NRk,6585
+pydantic_core-2.27.2.dist-info/RECORD,,
+pydantic_core-2.27.2.dist-info/WHEEL,sha256=tnHS7obT-gO4YuwU3a5mSl8Uehqv08QNc79nrmmPQq0,129
+pydantic_core-2.27.2.dist-info/licenses/LICENSE,sha256=Kv3TDVS01itvSIprzBVG6E7FBh8T9CCcA9ASNIeDeVo,1080
+pydantic_core/__init__.py,sha256=ZsyyaQjDPHSuRNN2L-pt_PpUTN-m1GEo-Y2WM6RhykE,4198
+pydantic_core/__pycache__/__init__.cpython-312.pyc,,
+pydantic_core/__pycache__/core_schema.cpython-312.pyc,,
+pydantic_core/_pydantic_core.cpython-312-x86_64-linux-gnu.so,sha256=HlB1N_HsiSU7aptvPeE3grHVdmtTB4ZERcSJFdtBaZ4,4616736
+pydantic_core/_pydantic_core.pyi,sha256=aMDpu1nHB2AMtZ5JXNy7k6vOdXEk6p72M6j-2icy7Kw,41434
+pydantic_core/core_schema.py,sha256=rMoHG7VwhVoT0mwGuhG5OLr0qCGetT1VZPCfZF4oHOI,145695
+pydantic_core/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
diff --git a/.venv/lib/python3.12/site-packages/pydantic_core-2.27.2.dist-info/WHEEL b/.venv/lib/python3.12/site-packages/pydantic_core-2.27.2.dist-info/WHEEL new file mode 100644 index 00000000..4a39e3d9 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/pydantic_core-2.27.2.dist-info/WHEEL @@ -0,0 +1,4 @@ +Wheel-Version: 1.0 +Generator: maturin (1.7.8) +Root-Is-Purelib: false +Tag: cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64 diff --git a/.venv/lib/python3.12/site-packages/pydantic_core-2.27.2.dist-info/licenses/LICENSE b/.venv/lib/python3.12/site-packages/pydantic_core-2.27.2.dist-info/licenses/LICENSE new file mode 100644 index 00000000..0716871c --- /dev/null +++ b/.venv/lib/python3.12/site-packages/pydantic_core-2.27.2.dist-info/licenses/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2022 Samuel Colvin + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. |