xym
xym extracts YANG modules from IETF RFCs and drafts. The source can be a local
text/RFCXML file or a URL, and extracted modules are written as .yang files.
Install
Install the latest published package from PyPI:
python -m pip install xym
Install from a local checkout:
git clone https://github.com/xym-tool/xym.git
cd xym
python -m pip install .
After installation, verify the command is available:
xym --version
xym --help
Usage
Extract all YANG modules from a local source file into the current directory:
xym path/to/rfc-or-draft.txt
Write output to a specific directory:
xym --dstdir ./yang path/to/rfc-or-draft.txt
Extract from a URL:
xym https://www.rfc-editor.org/rfc/rfc7223.txt
Use strict extraction, requiring <CODE BEGINS> and <CODE ENDS> markers:
xym --strict True path/to/rfc-or-draft.txt
Only extract valid example modules in strict mode:
xym --strict True --strict-examples path/to/rfc-or-draft.txt
Parse only selected modules:
xym --parse-only-modules ietf-interfaces example-module path/to/rfc-or-draft.txt
Skip selected modules:
xym --skip-modules example-module path/to/rfc-or-draft.txt
Check or add revisions in output filenames using pyang:
xym --force-revision-pyang path/to/rfc-or-draft.txt
Check or add revisions in output filenames using regular expressions:
xym --force-revision-regexp path/to/rfc-or-draft.txt
Parse an RFCXMLv3 source file:
xym --rfcxml path/to/rfc-or-draft.xml
Extract code snippets as well as YANG modules:
xym --extract-code-snippets --code-snippets-dir ./snippets path/to/rfc-or-draft.txt
Add source line references to extracted YANG modules:
xym --add-line-refs path/to/rfc-or-draft.txt
Strict Mode
The --strict and --strict-examples options affect which modules are written:
- No strict options: all YANG modules found in the source are extracted.
--strict True: only YANG modules inside<CODE BEGINS>and<CODE ENDS>are extracted.--strict True --strict-examples: only example modules outside<CODE BEGINS>and<CODE ENDS>with names starting withexample-are extracted.
The tool prints warnings and errors for source issues that may need inspection. For example, it reports invalid example module placement, missing revisions, and module names that do not match output filenames.
If an output .yang file already exists, xym does not overwrite it.
Development
This project uses Hatch for packaging, test environments, wheel building, and
version generation. Project metadata lives in pyproject.toml.
Install Hatch:
python -m pip install hatch
Show the version derived from Git tags:
hatch version
Run the test suite:
hatch run test:run
The tests include URL-based cases that fetch RFC text from the network. If those tests fail with DNS or connection errors, rerun them with network access.
Run the installed console command inside Hatch's test environment:
hatch run test:xym --version
Build source and wheel distributions:
hatch build
Build only the wheel:
hatch build -t wheel
Build artifacts are written to dist/.
Versioning
Versions are derived from Git tags with hatch-vcs. Release tags must use one
of these formats:
v0.10.0
v0.10.0rc1
The v prefix is stripped from the package version. During build/install, Hatch
generates xym/_version.py; that file is ignored by Git and should not be
edited or committed.
Continuous Integration
GitHub Actions are defined in .github/workflows/workflow.yaml.
Pull requests automatically run:
hatch run test:run
The workflow currently tests Python 3.10, 3.11, 3.12, and 3.13.
Publishing
Publishing uses PyPI trusted publishing with GitHub Actions OIDC. No PyPI API token secret is required.
Configure a trusted publisher for the PyPI project xym with:
- Repository owner:
xym-tool - Repository name:
xym - Workflow name:
workflow.yaml - Environment name: leave blank unless the workflow is later changed to use one
To publish a release wheel:
git tag v0.10.0
git push origin v0.10.0
To publish a release candidate wheel:
git tag v0.10.0rc1
git push origin v0.10.0rc1
The publish job runs only for pushed tags matching:
^v[0-9]+\.[0-9]+\.[0-9]+(rc[0-9]+)?$
The publish job depends on the test job. If tests fail, the wheel is not published.
Metadata
Release files for xym 0.10.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| xym-0.10.0-py3-none-any.whl | Python 3 | none | any | Details |
Release files / xym-0.10.0-py3-none-any.whl
| Download URL | xym-0.10.0-py3-none-any.whl |
|---|---|
| Size | 20.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d34d2c68d76c918d5cfb47903d4561f7758ad7b719e25bb8c9ea0263c2ecef0d
|
|
BLAKE2b-256 checksum How to use checksums |
706fbde3f6a61a022a714630a2098c98ac85a4f82410b7d317325110477f0a4b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 24, 2026.
Transparency log