Yeptris — the YAML package v0.6.22.1
An FFI-based (no C extension) YAML library over libyeptris v0.6.22. PyYAML-compatible semantics through ctypes — one shared library, zero compilation at install.
Installation
pip install yeptrisSelf-contained wheels over ctypes: the package binds the sharedlibyeptris at runtime — no compiler involved, on any platform. A vendored per-platform library copy ships beside the loader; YEPTRIS_LIB_PATH overrides it.
Usage
import yeptris
from yeptris import yaml # the PyYAML-compatible surface
yaml.safe_load("name: yeptris\nrating: 10\n")
# {'name': 'yeptris', 'rating': 10}
yaml.safe_load_all("--- 1\n--- two\n") # [1, 'two']
yaml.safe_dump({"b": 2, "a": [1, "x"]}) # 'a:\n - 1\n - x\nb: 2\n'
yeptris.load("k: v") # the neutral surface
yeptris.dump({"k": [1, 2]})Typing follows PyYAML’s SafeLoader (YAML 1.1 implicit typing):yes/no/on/off booleans, 0x/leading-0 integers, dot-required floats, timestamps with offsets, merge keys, anchor identity. Constructors are ported function-for-function; every deliberate divergence is pinned by a test.
One parse, one bulk drain
The FFI tax is O(1) per document, never per event: the record array and string arena are read in two ctypes calls, then a pure-Python walk over the unpacked records. The record layout is ABI-pinned in the C header and mirrored in the package — the same seam the Ruby gem rides.
docs = yeptris.load_all(stream) # multi-document streams
# [1, 'two'] for "--- 1\n--- two\n"
yeptris.dump({"k": [1, 2]}) # the DOM-mutation dumper:
# the C emitter's sizing, style
# chooser and escapes on Python treesErrors
try:
yaml.safe_load("a: [1,")
except yeptris.ParseError as e:
... # the C parser's message with line/column detailWhere to go next
- leptris/yeptris-py — the canonical repository.
- The C engine under the package
- The Ruby sibling gem
- The YAML benchmark campaigns
This is the curated guide. The repositories are canonical: when this page and the repo disagree, the repo wins. Full documentation lives with the source.