python-cydantic
conao3's pydantic CLI wrapper.
Install
Install from PyPI
release soon.
Install from Source
poetry install
Usage
generate
Prepare pydantic model named Model.
import pydantic
class Model(pydantic.BaseModel):
name: str = 'John Doe'
age: int = 20
Generate Model's schema.
$ cydantic generate -s sample/schema01.py
{
"properties": {
"name": {
"default": "John Doe",
"title": "Name",
"type": "string"
},
"age": {
"default": 20,
"title": "Age",
"type": "integer"
}
},
"title": "Model",
"type": "object"
}
Output using yaml format.
$ cydantic generate -s sample/schema01.py --format yaml
properties:
age:
default: 20
title: Age
type: integer
name:
default: John Doe
title: Name
type: string
title: Model
type: object
validate
$ cydantic validate -s sample/schema01.py -f yaml -i sample/inpt01.json
age: 20
name: conao3
$ cydantic validate -s sample/schema01.py -f yaml -i sample/inpt02.json
age: 18
name: conao3
$ cydantic validate -s sample/schema01.py -f yaml -i sample/inpt03.json
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/Users/conao/dev/repos/python-cydantic/src/cydantic/main.py", line 86, in main
args.handler(args)
File "/Users/conao/dev/repos/python-cydantic/src/cydantic/main.py", line 48, in command_validate
obj = model.model_validate(inpt)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/conao/dev/repos/python-cydantic/.venv/lib/python3.12/site-packages/pydantic/main.py", line 503, in model_validate
return cls.__pydantic_validator__.validate_python(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pydantic_core._pydantic_core.ValidationError: 1 validation error for Model
age
Input should be a valid integer, unable to parse string as an integer [type=int_parsing, input_value='Unknown', input_type=str]
For further information visit https://errors.pydantic.dev/2.5/v/int_parsing
Metadata
Release files for cydantic 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| cydantic-0.1.0.tar.gz | 6.4 kB | Without provenance | Details for cydantic-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cydantic-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for cydantic-0.1.0-py3-none-any.whl |
Total release size: 13.7 kB
Release files / cydantic-0.1.0.tar.gz
| Download URL | cydantic-0.1.0.tar.gz |
|---|---|
| Size | 6.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
abbcefa3649ebbe8289728eb09837ff65379e84003f1211bc4bfec2aa8a616ce
|
|
BLAKE2b-256 checksum How to use checksums |
c741bf89441f9ccd5873924d159f3eb151549d8a806f8101ed76d22e4d5c9f8b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.7.1 CPython/3.11.2 Linux/5.10.189-1-MANJARO
|
Release files / cydantic-0.1.0-py3-none-any.whl
| Download URL | cydantic-0.1.0-py3-none-any.whl |
|---|---|
| Size | 7.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
803050e7a7da07d1126f5fbe98fe758de4354b3cd1544d79c3a8e238dfabde6c
|
|
BLAKE2b-256 checksum How to use checksums |
2e65b7b0041d033b412c7b6bbad5a0bc40bafe0a90bc611e9bc373b27992296b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.7.1 CPython/3.11.2 Linux/5.10.189-1-MANJARO
|
Security for cydantic 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.