A prototype CLI tool to transform YANG models into Pydantic datastructures that can be initialized with config values and serialized into RESTCONF payloads.
Check out the documentation https://pydantify.github.io/pydantify/
For users
Installation
Prerequisites:
- Python 3.10
- pip
Installing from PYPI:
pip install pydantify
Installing from local folder:
pip install .
Usage
Example:
pydantify -i ./models_dir -o ./output_dir -t interfaces/ethernet model.yang
Transforms the /interfaces/ethernet node and its children (located in model.yang) into a Python script located in ./output_dir. Imports of definitions found in ./models_dir are included if relevant to the specified model and node.
Command syntax:
pydantify [-h] [-v] [-V] [-S] [-i INPUT_DIR] [-o OUTPUT_DIR] [-t TRIM_PATH] input_file
positional arguments:
input_file The YANG file containing the entrypoint to the model to evaluate.
options:
-h, --help show this help message and exit
-v, --verbose Enables debug output
-V, --include-verification
Adds validation code, as well as the relevant YANG files, to the output model.
-S, --standalone Generated output model has no dependency on Pydantify.
All required code is copied into the output model.
-i INPUT_DIR, --input-dir INPUT_DIR, --path INPUT_DIR
The directory that contains the YANG input model.
Defaults to the input file's folder.
-o OUTPUT_DIR, --output-dir OUTPUT_DIR
The directory that should be used to store the output model. Defaults to "$CWD/out".
-f OUTPUT_FILE, --output-file OUTPUT_FILE
The name of the output file. Defaults to "out.py".
-t TRIM_PATH, --trim-path TRIM_PATH
Get only the specified branch of the whole tree.
-j, --json-schema Output JSON schema instead of Pydantic models.
-d, --data-type {config,state}
Limit output to config or state only. Default is config and state combined.
-n, --strip-namespace
Strip the YANG namespace from the output model aliases.
NOTE: All unknown arguments will be passed to Pyang as-is and without guarantees.
For developers
Requirements
- Visual Studio Code
- Python 3.10
- UV
Links relevant to project
Pydantic
Explanations
Yang models
Pyang
Thanks
- Dejan Jovicic and Dominic Walther, who laid the foundations of pydantify
Metadata
Release files for pydantify 0.11.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 |
|---|---|---|---|---|
| pydantify-0.11.0.tar.gz | 15.2 kB | Without provenance | Details for pydantify-0.11.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pydantify-0.11.0-py3-none-any.whl | Python 3 | none | any | Details for pydantify-0.11.0-py3-none-any.whl |
Total release size: 36.5 kB
Release files / pydantify-0.11.0.tar.gz
| Download URL | pydantify-0.11.0.tar.gz |
|---|---|
| Size | 15.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a5ffc72ef9bd37086d6ab19fa3f4729fbb702caa072c193e9fd0f26db5de3a20
|
|
BLAKE2b-256 checksum How to use checksums |
a342454d540f58168ae66befeebf32ae93cf42b13e1e8cd6bbbe0c4bac7f287e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Release files / pydantify-0.11.0-py3-none-any.whl
| Download URL | pydantify-0.11.0-py3-none-any.whl |
|---|---|
| Size | 21.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7f74375d145a131dea5f820a50fa13770fb50760efb5391d75a1d417dfa45d30
|
|
BLAKE2b-256 checksum How to use checksums |
cb777c00f220652b442f9faafe2b0be2c5356b1b802f9d3f94809919806ec2f8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Security for pydantify 0.11.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.