- Notifications
You must be signed in to change notification settings - Fork6
Transform YANG models into pydantic datastructures
License
pydantify/pydantify
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Aprototype 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/
Prerequisites:
- Python 3.10
- pip
Installing from PYPI:
pip install pydantify
Installing from local folder:
pip install.
Example:
pydantify-i./models_dir-o./output_dir-tinterfaces/ethernetmodel.yang
Transforms the/interfaces/ethernet
node and its children (located inmodel.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] [-iINPUT_DIR] [-oOUTPUT_DIR] [-tTRIM_PATH]input_filepositionalarguments:input_fileTheYANGfilecontainingtheentrypointtothemodeltoevaluate.options:-h,--helpshowthishelpmessageandexit-v,--verboseEnablesdebugoutput-V,--include-verificationAddsvalidationcode,aswellastherelevantYANGfiles,totheoutputmodel.-S,--standaloneGeneratedoutputmodelhasnodependencyonPydantify.Allrequiredcodeiscopiedintotheoutputmodel.-iINPUT_DIR,--input-dirINPUT_DIR,--pathINPUT_DIRThedirectorythatcontainstheYANGinputmodel.Defaultstotheinputfile'sfolder.-oOUTPUT_DIR,--output-dirOUTPUT_DIRThedirectorythatshouldbeusedtostoretheoutputmodel.Defaultsto"$CWD/out".-fOUTPUT_FILE,--output-fileOUTPUT_FILEThenameoftheoutputfile.Defaultsto"out.py".-tTRIM_PATH,--trim-pathTRIM_PATHGetonlythespecifiedbranchofthewholetree.-j,--json-schemaOutputJSONschemainsteadofPydanticmodels.-d,--data-type {config,state}Limitoutputtoconfigorstateonly.Defaultisconfigandstatecombined.NOTE:AllunknownargumentswillbepassedtoPyangas-isandwithoutguarantees.
- Visual Studio Code
- Python 3.10
- PDM package manager
Note: instructions with the same indentation are alternatives to eachother.
- Install
- dependencies through pdm (
pdm install
in project root)- into the local
__pypackages__
folder- to run your project as a python module
- locally (
python -m pydantify
) - in a docker container (seeDockerfile)
- locally (
- to be accessed by your IDE for intellisense (see.vscode/settings.json)
- to be accessed by your debug launch configuration (see.vscode/launch.json)
- to run your project as a python module
- into the local
- project through pip (see guide for users)
- dependencies through pdm (
- Build
- through pdm (
pdm build
)- into the local
dist
folder- to be published on pypi
- through twine (
twine upload dist/*
)
- through twine (
- to be published on pypi
- into the local
- through pdm (
- Dejan Jovicic and Dominic Walther, who laid the foundations of pydantify
About
Transform YANG models into pydantic datastructures
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors6
Uh oh!
There was an error while loading.Please reload this page.