Skip to main content

Rustine

CI PyPI Docs License

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 — GelError with 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 — rgel binary 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.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rustine 1.0.0
File Size Uploaded Provenance Actions
rustine-1.0.0.tar.gz 101.2 kB With provenance Details for rustine-1.0.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for rustine 1.0.0
File Actions
rustine-1.0.0-cp311-abi3-win_amd64.whl CPython 3.11 abi3 Windows x86-64 Details for rustine-1.0.0-cp311-abi3-win_amd64.whl
rustine-1.0.0-cp311-abi3-win32.whl CPython 3.11 abi3 Windows x86-32 Details for rustine-1.0.0-cp311-abi3-win32.whl
rustine-1.0.0-cp311-abi3-musllinux_1_2_x86_64.whl CPython 3.11 abi3 Linux musl 1.2+ x86-64 Details for rustine-1.0.0-cp311-abi3-musllinux_1_2_x86_64.whl
rustine-1.0.0-cp311-abi3-musllinux_1_2_aarch64.whl CPython 3.11 abi3 Linux musl 1.2+ ARM64 Details for rustine-1.0.0-cp311-abi3-musllinux_1_2_aarch64.whl
rustine-1.0.0-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.11 abi3 Linux glibc 2.17+ x86-64 Details for rustine-1.0.0-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
rustine-1.0.0-cp311-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl CPython 3.11 abi3 Linux glibc 2.17+ ARM64 Details for rustine-1.0.0-cp311-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
rustine-1.0.0-cp311-abi3-macosx_11_0_arm64.whl CPython 3.11 abi3 macOS 11.0+ ARM64 Details for rustine-1.0.0-cp311-abi3-macosx_11_0_arm64.whl
rustine-1.0.0-cp311-abi3-macosx_10_12_x86_64.whl CPython 3.11 abi3 macOS 10.12+ x86-64 Details for rustine-1.0.0-cp311-abi3-macosx_10_12_x86_64.whl

Total release size: 8.4 MB

Release files / rustine-1.0.0.tar.gz

Download URL rustine-1.0.0.tar.gz
Size 101.2 kB
Tags Source
SHA-256 checksum
How to use checksums
300e03696fd0c9261cebe17324b83245d5924e6e7635071c40bcfd8c546840ad
BLAKE2b-256 checksum
How to use checksums
c2c3b052951bc4080a2eb776c66da131a377ea261753f6efd3b54487a77ee496
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 log

Release files / rustine-1.0.0-cp311-abi3-win_amd64.whl

Download URL rustine-1.0.0-cp311-abi3-win_amd64.whl
Size 918.3 kB
Tags CPython 3.11 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
0964a6276fd70eb75a0403ce2952ac04c06ae65e180cb52a95b28f0ff51eb911
BLAKE2b-256 checksum
How to use checksums
ee5c5458e0a1f6d658681fe4ecf73dde45a978e6c055921c0d47eecc41f24954
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 log

Release files / rustine-1.0.0-cp311-abi3-win32.whl

Download URL rustine-1.0.0-cp311-abi3-win32.whl
Size 828.4 kB
Tags CPython 3.11 Windows x86-32 abi3
SHA-256 checksum
How to use checksums
afa8ee95c38a45f697a7ba729932a4d933687c83082eae7a2120db7c54c39d43
BLAKE2b-256 checksum
How to use checksums
7920d8d7e574f8b35272e08ca656c4648997059527dc3658154bb8a4fc9a79c2
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 log

Release files / rustine-1.0.0-cp311-abi3-musllinux_1_2_x86_64.whl

Download URL rustine-1.0.0-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
ba6a92a56755c8eabd482bcc93c4debd657642827efdf4d4584b59bcfd344eb0
BLAKE2b-256 checksum
How to use checksums
32b5ba4a14a482b7721b992457b0662a4b93383a09d54ebc7476a4e2106bf9de
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 log

Release files / rustine-1.0.0-cp311-abi3-musllinux_1_2_aarch64.whl

Download URL rustine-1.0.0-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
ca9443dfbabc42011ae032cd234e1fdb8650032a95650321ac391bbd52c3f04b
BLAKE2b-256 checksum
How to use checksums
21e7cf2ed9c28125cf9e14c356144a53d8f26e67e826fd2efef852c5986d1d01
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 log

Release files / rustine-1.0.0-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL rustine-1.0.0-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
6d41b4094d09cd7220490cf40bdb85320da98166639a3a622b461fc2a6bdd0ad
BLAKE2b-256 checksum
How to use checksums
c00e00286e18e37d0912229eb06fd33685e568facf9575d77795101fba1993a7
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 log

Release files / rustine-1.0.0-cp311-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL rustine-1.0.0-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
a5ba29e2bdd2aef2fe84f3b5d15990f2756b7ffad73e1b52dc24e7a51f28039e
BLAKE2b-256 checksum
How to use checksums
51a52eb5a77ae49a557364b506064f1e8e9a554c3e250818a2a7069b84797d24
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 log

Release files / rustine-1.0.0-cp311-abi3-macosx_11_0_arm64.whl

Download URL rustine-1.0.0-cp311-abi3-macosx_11_0_arm64.whl
Size 833.5 kB
Tags CPython 3.11 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
2dddf99b1314aa4004f10ae3e6bb919ddc80240f42d7bdb11c3e62d41a71ef39
BLAKE2b-256 checksum
How to use checksums
085baa9ce641ec579a460ddbaa6cdcafe773d52e4f9c0c1f0e4caf6e176c25f3
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 log

Release files / rustine-1.0.0-cp311-abi3-macosx_10_12_x86_64.whl

Download URL rustine-1.0.0-cp311-abi3-macosx_10_12_x86_64.whl
Size 888.4 kB
Tags CPython 3.11 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
f839a7261bfc39bf4dc517f076b97991e9f7c8ee3d3ba0da4d3c43aca677097c
BLAKE2b-256 checksum
How to use checksums
ea025519e8a0bf5bdf423b650a16107906c7f4d2ef87044ffd0b3a7d66f9a248
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 log

Security for rustine 1.0.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.

Full provenance

All 9 files in this release have been uploaded with provenance metadata.

Select from 9 files

Attestation for rustine-1.0.0.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 log

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page