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 has been a reliable tool for converting network device output and other semi-structured text into structured data. However, its core dependency — SimpleParse — has not been updated for Python 3.12+ and is no longer maintained. This made Gelatin incompatible with modern Python versions.

Rustine solves this by reimplementing the entire Gelatin engine in Rust:

  • Drop-in replacement — same Gel grammar language, same output format
  • 10–19× faster than Python Gelatin (depending on workload and platform)
  • 3–4× less memory on large inputs
  • Works on Python 3.9–3.13+ via PyO3 — no C extension dependency
  • 100% feature parity with the original Python implementation

Quick Start

Python

pip install rustine
from Rustine import rustine

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()
"""

input_text = "Name: Alice\nAge: 30\nOffice: 1st Ave\n"
print(rustine.parse_to_json(grammar, input_text))

Rust

cargo add rustine --no-default-features
use rustine::exec::{execute, serialize_execution, RuntimeFormat};

let result = execute(grammar_source, input_text);
let json = serialize_execution(&result, RuntimeFormat::Json);

CLI

cargo install rustine --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

Performance

Benchmarked on 20.9 MB real-world IOS XR configuration (263 grammars, 113 regex patterns, 899 757 output nodes):

Tool / Platform Time Throughput Peak RSS
Python Gelatin (Win) 66.3 s 0.33 MB/s 3 075 MB
Rustine (Win) 4.10 s 5.1 MB/s 496 MB
Rustine (jemalloc) 2.31 s 9.1 MB/s 456 MB
Comparison Speedup
Rustine vs Python Gelatin (scale) 17–19×
Rustine vs Python Gelatin (CLI) 11–13×
Rustine vs textfsm (25 MB) 1.6×

See BENCHMARKS.md for full cross-platform results (Windows, Linux glibc, Linux jemalloc), serialization timings, and reproduction instructions.

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
  • Streaming execution — feed chunks incrementally via StreamingRunner
  • 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

Cargo Features (compile-time)

Features are selected at build time via --features and control which capabilities are compiled into the binary. See Getting Started → Cargo Features for the full table and usage examples.

Key features: cli, jemalloc (default in Linux wheels), mimalloc, mmap, parallel, python (default).

Documentation

Document Description
Getting Started Installation, first steps, Python/Rust/CLI usage
Gel Syntax Reference Grammar language, statements, actions, triggers
Architecture Parser pipeline, module layout, design decisions
Performance Optimization techniques, benchmark overview
BENCHMARKS.md Raw benchmark data for all platforms
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 0.2.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 0.2.0
File Size Uploaded
rustine-0.2.0.tar.gz 106.2 kB Details

Built distributions (wheels)

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

Total release size: 9.3 MB

Release files / rustine-0.2.0.tar.gz

Download URL rustine-0.2.0.tar.gz
Size 106.2 kB
Tags Source
SHA-256 checksum
How to use checksums
1838da7f2c4487275c82b33822a7a5602312e41530d719f1c5d4d1bdcea1112f
BLAKE2b-256 checksum
How to use checksums
d0824001281a6eaa7c25f154d88b5f728faf35577a996905025b1532bca8b14e
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 Jun 25, 2026.

Transparency log

Release files / rustine-0.2.0-cp39-abi3-win_amd64.whl

Download URL rustine-0.2.0-cp39-abi3-win_amd64.whl
Size 904.8 kB
Tags CPython 3.9 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
b6756bf428ebe9583cb8b5037dd503441bb8e910fffa46c53c9b744f7a462cdc
BLAKE2b-256 checksum
How to use checksums
1182c7a5e016156afcb42d0f9eef8295e081e78cd79c84cf6ec425ab4c3423e3
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 Jun 25, 2026.

Transparency log

Release files / rustine-0.2.0-cp39-abi3-win32.whl

Download URL rustine-0.2.0-cp39-abi3-win32.whl
Size 810.8 kB
Tags CPython 3.9 Windows x86-32 abi3
SHA-256 checksum
How to use checksums
5733f885c609a7be2e03d08c3bf5cc660175eed4e5014e8a34aaa4c2040c84f7
BLAKE2b-256 checksum
How to use checksums
75b44d45bf7dc52e28a3dbc0a30175957877a067852e94c6d28d53a0895cccc3
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 Jun 25, 2026.

Transparency log

Release files / rustine-0.2.0-cp39-abi3-musllinux_1_2_x86_64.whl

Download URL rustine-0.2.0-cp39-abi3-musllinux_1_2_x86_64.whl
Size 1.2 MB
Tags CPython 3.9 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
facfc8b20042e3b6e59f4a48f3319b6be1f260c1836e574eeebebbeded334e71
BLAKE2b-256 checksum
How to use checksums
087451cdd0fcd758e9ca361585d4524f7ecb6642c529f7ec98fb3509ecb901ec
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 Jun 25, 2026.

Transparency log

Release files / rustine-0.2.0-cp39-abi3-musllinux_1_2_aarch64.whl

Download URL rustine-0.2.0-cp39-abi3-musllinux_1_2_aarch64.whl
Size 1.1 MB
Tags CPython 3.9 Linux musl 1.2+ ARM64 abi3
SHA-256 checksum
How to use checksums
637653f68c2ed076397918c9ea09a36d19d6918e45f03478ff7df7347754b44c
BLAKE2b-256 checksum
How to use checksums
36c10891921eadf6484ed801fac7b66f2a681d31b511868499a2d234832fab8a
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 Jun 25, 2026.

Transparency log

Release files / rustine-0.2.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL rustine-0.2.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 1.2 MB
Tags CPython 3.9 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
1bb7e830e57e73eb61404135406edba38082c3157694ddefbe076b5dda5f36b5
BLAKE2b-256 checksum
How to use checksums
9c026a584fe821c2281292b1405abe73dbcb7e6412ab84939f24c206d57234cc
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 Jun 25, 2026.

Transparency log

Release files / rustine-0.2.0-cp39-abi3-manylinux_2_17_i686.manylinux2014_i686.whl

Download URL rustine-0.2.0-cp39-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
Size 1.2 MB
Tags CPython 3.9 Linux glibc 2.17+ x86-32 abi3
SHA-256 checksum
How to use checksums
3f0c50415d80d78038e330682431d20bc8a47e1d1291fdeac2b01cea3f45ceb9
BLAKE2b-256 checksum
How to use checksums
1a3a11abf0f3545fde24844353515ff1d0010705615db3735c865bc0b7570556
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 Jun 25, 2026.

Transparency log

Release files / rustine-0.2.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL rustine-0.2.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 1.1 MB
Tags CPython 3.9 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
f82d2f2bc1cf5e7d703a6727db53c1a405a2c7e67f66cf9d111027399a1f07c0
BLAKE2b-256 checksum
How to use checksums
093b9f145931de04ebae46f8112bf548ca9403cdef390975b188dd71c72da769
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 Jun 25, 2026.

Transparency log

Release files / rustine-0.2.0-cp39-abi3-macosx_11_0_arm64.whl

Download URL rustine-0.2.0-cp39-abi3-macosx_11_0_arm64.whl
Size 867.5 kB
Tags CPython 3.9 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
fe0917e2356028a669d170034e149642a8fb410acd4445c2a7f033622c5568a6
BLAKE2b-256 checksum
How to use checksums
0d232eaab1e7ee0c015c047dd171519af727964afd5b31fbb0362f0b03adf410
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 Jun 25, 2026.

Transparency log

Release files / rustine-0.2.0-cp39-abi3-macosx_10_12_x86_64.whl

Download URL rustine-0.2.0-cp39-abi3-macosx_10_12_x86_64.whl
Size 916.9 kB
Tags CPython 3.9 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
5f5ed3835c435aed0e76a186ba88f2da0c1883c5d3e59c19d6e95285f9e5cd81
BLAKE2b-256 checksum
How to use checksums
798aa04255883b8bd1d12ac556053397f2086a5518e45307e43aba064ea65207
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 Jun 25, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.0 This release

10 release files

0.1.1

6 release files

0.1.0

6 release files

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