pyang
A YANG (RFC 6020/7950) validator and converter
What it is and what it does
pyang is a YANG validator and code generator for network data models. YANG (RFC 7950) is a data modeling language used with NETCONF for network device configuration. pyang reads YANG modules, validates them for correctness against the YANG grammar and RFC specifications, and can transform them into other formats (YIN, DSDL schemas, UML diagrams, tree representations, XML skeletons, and JSON). It includes a plugin system for extending its output capabilities, making it suitable for both standalone validation workflows and integration into larger network automation or code-generation pipelines.
The package depends only on lxml for XML processing and is written in pure Python, making it portable across platforms. It has been actively maintained since its first release, with support for Python 3.7 through 3.11. The tool is commonly used by network engineers and automation developers who need to validate vendor or standards-based YANG models, generate documentation from data models, or translate models into formats suitable for schema validation or code generation.
Use it for:
- Validate YANG modules from network device vendors or IETF standards before deploying them in NETCONF-based automation.
- Convert YANG models to DSDL schemas for validating XML instance documents from network devices.
- Generate tree diagrams or UML visualizations of YANG data models for documentation and design review.
- Transform YANG modules to YIN (XML representation) for processing or archival in XML-based workflows.
- Build custom code generators by writing pyang plugins to emit device-specific or language-specific code from YANG models.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
pyang validates YANG data models (RFC 7950), converts between YANG and YIN formats, and generates code and documentation from YANG modules via a plugin framework.
Yes. pyang is a stable, actively maintained tool with no known vulnerabilities, low install friction, and a permissive license. Install it if you work with YANG models, NETCONF, or network data modeling; otherwise, it is not a general-purpose utility.
Install
pyang on PyPI
pip
pip install pyanguv
uv add pyangpoetry
poetry add pyangInstalling pyang
Before you install
Low install friction; pure Python wheel with a single runtime dependency (lxml). Actively maintained with a recent release (2025-08-29) and ongoing repository activity.
License in practice
BSD permissive license allows use in most commercial and open-source projects without significant restriction.
Quickstart
pip install pyang
python -c "from pyang import context; ctx = context.Context()"
Verify before relying
- Whether the plugin framework is documented well enough for custom code generation without reading source code.
- Performance characteristics when validating large or deeply nested YANG modules.
- Whether all IETF RFCs listed (RFC 6020, 6087, 6110, 6643, 7950, 7952, 8040, 8407, 8791, 9595) are fully implemented or partially supported.
Package facts
| License | BSD (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — lxml |
| Maintenance | actively maintained — 350 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 591,014/month — #5,856 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pyang-2.7.1-py2.py3-none-any.whl
Keywords: YANG, validator
Tags
More Software Development packages
Provides backported and experimental type hints…
permissive · top 100 on PyPI
numpyNumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
distlibDistlib provides low-level packaging utilities…
permissive · top 1,000 on PyPI
pyangbindPyangBind converts YANG data models into Python…
permissive · top 15,000 on PyPI
yang.connectorProvides NETCONF and gRPC/GNMI client…
permissive · top 15,000 on PyPI
abnfGenerates parsers from ABNF grammars as…
permissive · top 5,000 on PyPI
jschonValidates JSON data against JSON Schema (drafts…
permissive · top 15,000 on PyPI
rfc3986-validatorValidates URLs and URI references against the…
permissive · top 1,000 on PyPI
fqdnValidates fully-qualified domain names (FQDNs)…
copyleft · top 1,000 on PyPI
eidoValidates project metadata against PEP schemas…
permissive · top 15,000 on PyPI
iregexp-checkValidates regular expressions against RFC 9485…
permissive · top 15,000 on PyPI
xsdataxsdata generates Python dataclasses from XML…
permissive · top 5,000 on PyPI
asdf-transform-schemasProvides ASDF schemas for validating transform…
unclear · top 15,000 on PyPI