Rustine
High-performance Gel syntax parser that transforms unstructured text into JSON, XML, or YAML. A complete Rust rewrite of Python Gelatin, usable as a native Python module, a Rust library, or a standalone CLI tool.
Why Rustine?
Gelatin depends on SimpleParse, which does not support Python 3.12+. Rustine reimplements the engine in Rust:
- Drop-in replacement — same Gel grammar language, same output
- 30–37× faster than Python Gelatin on large inputs, 5.5–8.4× less memory
- Python 3.11+ — abi3 wheels, no SimpleParse
Quick Start
Python
pip install rustine
from Rustine.util import compile_string, generate_string
grammar = r"""
define nl /\r?\n/
define ws /\s+/
grammar input:
match 'Name:' ws /[^\r\n,]+/ /(?:\r?\n|,) */:
out.open('user')
out.add_attribute('.', 'name', '$2')
match /[\w ]+/ ':' ws /[^\r\n,]+/ /(?:\r?\n|,) */:
out.add('$0', '$3')
match nl:
do.return()
"""
converter = compile_string(grammar)
print(generate_string(converter, "Name: Alice\nAge: 30\nOffice: 1st Ave\n", format="json"))
Rust
cargo add rustine --no-default-features
use rustine::exec::{execute, serialize_tree, RuntimeFormat};
use rustine::parser::{lexer::lex, syntax::parse_gel_document};
let mut doc = parse_gel_document(&lex(grammar_source)?)?;
let result = execute(&mut doc, "input", input_text)?;
let json = serialize_tree(&result, RuntimeFormat::Json)?;
CLI
cargo install rustine --no-default-features --features cli
rgel -s syntax.gel -f json input.txt
rgel -s syntax.gel -f xml input.txt
rgel -s syntax.gel -f yaml input.txt
# Keep the case of tag names (default: lowercase)
rgel -s syntax.gel --preserve-case input.txt
Performance
A 20.6 MB pseudonymized IOS XR configuration (shipped in fixtures/)
converted to JSON, each engine in a new process on the same Linux PC
(146 grammars, 862 744 output nodes):
| Engine | Instructions | Peak memory | Time |
|---|---|---|---|
| Python Gelatin, CPython 3.10 | 358 G | 1 927 MB | 38.8 s |
| Python Gelatin, CPython 3.11 | 279 G | 1 907 MB | 34.2 s |
| Rustine (Python 3.11) | 14.8 G | 346 MB | 1.13 s |
| Rustine (Rust) | 14.0 G | 342 MB | 1.05 s |
Instructions (G = 10⁹) measure the work independently of the CPU, times do not. BENCHMARKS.md adds a synthetic 25 MB input, small inputs and Windows, and shows how to repeat the measurement.
Alternatives
| Tool | Approach | Output | vs Rustine |
|---|---|---|---|
| textfsm | Line-by-line FSM templates | Flat tables (list of dicts) | Simpler for quick extraction; no hierarchy, no nesting, pure Python |
| TTP | Template-based parsing | Nested dicts | Flexible templates; Python-only, slower on large inputs |
| Napalm | Device abstraction + textfsm | Flat dicts per getter | Higher-level (device drivers); not a general text parser |
| PyATS/Genie | Model-driven parsing | Structured models | Cisco ecosystem; heavy dependencies, not general-purpose |
| nom / pest | Rust parser combinators / PEG | Custom AST | Maximum flexibility; requires writing a parser in code, no DSL file |
Rustine's niche: a grammar-driven text→tree transformer with a concise DSL
(.gel files), hierarchical output, and native performance. It sits between
simple template extractors (textfsm) and full parser generators (nom/pest).
Feature Highlights
- Gel grammar language — match, imatch, when, skip, define, grammar inheritance
- Rich output actions — create, add, replace, add_attribute, open, enter, leave, set_root_name
- Trigger system — enqueue_before/after/on_add/on_leave (single-shot and persistent)
- Captures — positional (
$1,$2) and named ($name) with interpolation in paths and values - Three output formats — JSON, XML, YAML
- Structured errors —
GelErrorwith source spans (line, column, offset) - Semantic validation — regex pre-validation, inheritance checks, undefined grammar/variable warnings
- Python bindings — PyO3 + maturin, installable via
pip - CLI tool —
rgelbinary for shell pipelines
Documentation
| Document | Description |
|---|---|
| Installation | pip, source build, Rust crate, CLI, Cargo features |
| Getting Started | Python, Rust and CLI usage, tests, benchmarks |
| Gel Syntax Reference | Grammar language, statements, actions, triggers |
| Architecture | Parser pipeline, module layout, design decisions |
| Performance | Optimization techniques, benchmark overview |
| BENCHMARKS.md | Results against Python Gelatin, method, how to reproduce |
| Migration from Gelatin | Drop-in replacement guide, parity notes |
| Contributing | Development setup, coding guidelines, PR process |
| Changelog | Version history |
License
Dual-licensed under MIT or Apache-2.0.
Metadata
Release files for rustine 1.0.1
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 |
|---|---|---|---|---|
| rustine-1.0.1.tar.gz | 105.1 kB | With provenance | Details for rustine-1.0.1.tar.gz |
Built distributions (wheels)
Total release size: 8.4 MB
Release files / rustine-1.0.1.tar.gz
| Download URL | rustine-1.0.1.tar.gz |
|---|---|
| Size | 105.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4e9c1b3978b24316e8afde4d8caf6b0c23d749f9258354b87e1ece22b8b4326c
|
|
BLAKE2b-256 checksum How to use checksums |
af7d52fb6eb592dd248fb10686d791bb164b59d6efec082cc683f857cea88920
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 13, 2026.
Transparency logRelease files / rustine-1.0.1-cp311-abi3-win_amd64.whl
| Download URL | rustine-1.0.1-cp311-abi3-win_amd64.whl |
|---|---|
| Size | 917.6 kB |
| Tags | CPython 3.11 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
dbc067a60447747e502f4e4ef9f9b8a14b9411ed02344aa1b2e018f0adaf985b
|
|
BLAKE2b-256 checksum How to use checksums |
8361e09cf928f5d87a391e0ab6ec4f72dcd44a20afd4d7ca27d78903cbd0b6a3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 13, 2026.
Transparency logRelease files / rustine-1.0.1-cp311-abi3-win32.whl
| Download URL | rustine-1.0.1-cp311-abi3-win32.whl |
|---|---|
| Size | 827.5 kB |
| Tags | CPython 3.11 Windows x86-32 abi3 |
|
SHA-256 checksum How to use checksums |
9835f39163d4f116c1b4b7860678c42b151d35ad9e872a0c189f6130e7c48efb
|
|
BLAKE2b-256 checksum How to use checksums |
fba174d1aab0a70b4f9a35b1ee1f6103008dadbbbf84bb727e5529b71076865e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 13, 2026.
Transparency logRelease files / rustine-1.0.1-cp311-abi3-musllinux_1_2_x86_64.whl
| Download URL | rustine-1.0.1-cp311-abi3-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 1.4 MB |
| Tags | CPython 3.11 Linux musl 1.2+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
8d07aeab899e031e075cc9297be69aa3e7fb6653fdfee7a9e1298b64e75f7f5f
|
|
BLAKE2b-256 checksum How to use checksums |
57d600ee0f9bdea146249f48502c02126c1a1b6262440c503815c24b71dca3a1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 13, 2026.
Transparency logRelease files / rustine-1.0.1-cp311-abi3-musllinux_1_2_aarch64.whl
| Download URL | rustine-1.0.1-cp311-abi3-musllinux_1_2_aarch64.whl |
|---|---|
| Size | 1.3 MB |
| Tags | CPython 3.11 Linux musl 1.2+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
a64b37c8064f02302b9340fd062fbd3f4884c519ceb28fe6298b6325308d43fa
|
|
BLAKE2b-256 checksum How to use checksums |
c2963d89f0403dc78bf1bda0556a6450c4c162e9548651de4653012e076afcb8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 13, 2026.
Transparency logRelease files / rustine-1.0.1-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
| Download URL | rustine-1.0.1-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
|---|---|
| Size | 1.1 MB |
| Tags | CPython 3.11 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
246f9423c9db0e8cff1de1e27f65aa48c5bb5ebbc42a46e7d9c33b5b2f43667d
|
|
BLAKE2b-256 checksum How to use checksums |
6aca327b309e26bf5f09a28f954ded1e6724166dfa62e79e4f90f23a8466e77a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 13, 2026.
Transparency logRelease files / rustine-1.0.1-cp311-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
| Download URL | rustine-1.0.1-cp311-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl |
|---|---|
| Size | 1.1 MB |
| Tags | CPython 3.11 Linux glibc 2.17+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
18e6039673ef35a6ddae6e058fa63e2b458440c54ea5bdf0547b2f61f79eecb8
|
|
BLAKE2b-256 checksum How to use checksums |
9d36203d9ff0c107a2ed30af94fe98d5bd6722686b1eede449cd0f6c0449f391
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 13, 2026.
Transparency logRelease files / rustine-1.0.1-cp311-abi3-macosx_11_0_arm64.whl
| Download URL | rustine-1.0.1-cp311-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 833.9 kB |
| Tags | CPython 3.11 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
91f14b609f02ca6a2548c06d0b5372bcd95df407f7d9e70fe8f01feb2d0dc67f
|
|
BLAKE2b-256 checksum How to use checksums |
a405cbc1923774672e83f73b6a36f254c8f0b4376bce7d36965b855810d0244e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 13, 2026.
Transparency logRelease files / rustine-1.0.1-cp311-abi3-macosx_10_12_x86_64.whl
| Download URL | rustine-1.0.1-cp311-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 887.8 kB |
| Tags | CPython 3.11 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
f3f7cc835950e961a8c9926396578d42349b03f2f5511ab7ba3d85a923fce34a
|
|
BLAKE2b-256 checksum How to use checksums |
ed91f58898db7823ae1088d239043b6f34510981244548c5451ad10fdec0a3ef
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 13, 2026.
Transparency logSecurity for rustine 1.0.1
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.
Full provenance
All 9 files in this release have been uploaded with provenance metadata.
Attestation for rustine-1.0.1.tar.gz
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 Nov 13, 2026.
Transparency logA 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.