YAML, parsed at
library speed.
yeptris is the YAML counterpart of libleptris: a YAML 1.2 parser, writer and streamer in pure C11 — zero required dependencies, a stable C ABI, opaque handles — with bindings shaped like the incumbents: a Psych-compatible Ruby gem, a PyYAML-compatible Python package, a Rust crate and a JavaScript/WASM package.
- Speed with a referee — every figure comes from the open benchmark lane: interleaved runs, pinned competitors, medians, a performance ledger kept in the repository.
- Conformance first — 395/395 on the yaml-test-suite, the libyaml emission goldens with zero divergences, ASan/UBSan/TSan suites, and a nightly libFuzzer lane 270+ rounds deep with every catch shipped or carried.
- One core, five runtimes — the same C11 engine from C, Ruby, Python, Rust, and JavaScript; every runtime releases in lockstep with the engine.
What it is
An engine built like a ledger, not a claim
yeptris is YAML 1.2 first — with a libyaml/Psych-compatible YAML 1.1 lenient mode for the real world. The yaml-test-suite is the conformance bar; every divergence is documented; every performance statement reproduces from the benchmark harness and the ledger (benchmarks/PERF-LEDGER.md).
The race, in the open
The interleaved head-to-head runs in CI on every push — nine document shapes across DOM, pull, recorder and emit, medians of rounds on fresh runners: every shape ahead of rapidyaml (1.8–8.5× ubuntu; 1.5–4.0× macOS; anchor-heavy — the one parity cell — moved to 1.34× on the per-line memo). Against libyaml the DOM lane reads 5.8–11.6× and emit 4.7–21.5× per shape.
Conformant where it counts
The full verification matrix: yaml-test-suite pinned atda267a5, psych-pure’s 67 corpus files, JSONTestSuite 95/95 accept and 188/188 reject in strict mode, the 405-input libyaml parse differential with full-record equality — and the fuzz nightly, 270+ rounds in, every catch shipped or carried: eighteen engine fixes — none since r248 — and 235 fuzzing-gated pins green. The classifier era: the flow-soup family proved measured-unbounded (five consecutive carries r263–r267), so the law-verifying classifier derives both engines’ expected dumps and requires them byte-exact, and the r272 mining harvest closed the decline surface (72 shapes: 48 exact-bytes pins + 10 classifier extensions). And the emitter writes stored files the way Psych and libyaml do: block plain and single-quoted scalars fold at 80 columns by default (Psych’s line_width: -1 unwraps), byte-exact against the emission goldens.
Beyond the DOM
Three consumption models over one engine: pull events (StAX-style, zero C→host callbacks — the FFI-friendly form), libyaml-compatible push events, and a packed record tape for bulk drains. Plans and schemas walk documents into typed columns with no intermediate tree. Zero-copy value views in C.
Packaging that installs
Ruby: fat platform gems (no C extension — FFI), every major OS×arch tier, lockstep-released with the engine. Python: self-contained wheels over ctypes, zero compilation at install. C: cmake --install with pkg-config.
The surface
Shaped like the incumbents
Ruby mirrors Psych (its YAML 1.1 implicit typing is the default; schema: :core_12 switches to the 1.2 core schema), and drops in beside it — including the error names. Python mirrors PyYAML’s safe surface.
#include <yeptris/yeptris.h>
YeptrisStatus st;
YeptrisDocument doc = yeptris_parse(data, len, &st);
if (!doc) {
uint32_t line, col;
const char *msg = yeptris_last_error(&line, &col); /* 1-based */
}
size_t n = yeptris_document_count(doc);
YeptrisNode root = yeptris_document_root(doc, 0);
YeptrisNode port = yeptris_node_map_get(root, "port", 4);
char *out = NULL; size_t out_len = 0;
out = yeptris_serialize(doc, &out_len); /* canonical YAML */
yeptris_document_free(doc); /* one free for everything */The chase begins
Install, five ways
| surface | command | what you get |
|---|---|---|
| Ruby | gem install yeptris | a prebuilt platform gem where one exists — FFI over the shared library, zero compilation at install |
| Python | pip install yeptris | a self-contained wheel — ctypes FFI over libyeptris, PyYAML-compatible semantics |
| C | cmake -B build -S . && cmake --build build | LTO on by default; cmake --install carries headers and pkg-config |
| Rust | cargo add yeptris | thin safe FFI over libyeptris — YEPTRIS_LIB_PATH or the opt-in vendored feature (a checked-in engine snapshot, statically linked) |
| JavaScript | npm install yeptris | the engine compiled to WebAssembly (ES module) — load/dump/events/schema validation over the recorder bulk drain |
Fast as hares.
Parsed at library speed.
yeptris v0.6.75 live across all five runtimes — libyeptris v0.6.75, the yeptris gem v0.6.75.0, the yeptris package v0.6.75.0, the Rust crate and the JS/WASM package at the same C semver. Repos canonical: yeptris, yeptris-ruby, yeptris-py, yeptris-rs, yeptris-ts.