tpt-yaml

Rust

A dependency-free Rust YAML toolkit — core parser/lexer, serde support, format-preserving editing, JSON Schema validation, and a CLI — built as a family of crates from the ground up (YAML 1.1/1.2 aware).

0 stars0 forks0 watchersApache License 2.0

Languages

Rust94.3%C2.8%HTML2.7%Python0.2%
README

tpt-yaml

CI MSRV License

A dependency-light YAML toolkit for Rust, split into small crates so you only pay for what you use. No dependency on any tpt-io-* crate — this family is standalone.

CrateStatusDescription
tpt-yaml-coreimplemented, unreleasedLexer, parser, arena-based node model, event-driven streaming parser, no_std + alloc + std, zero external dependencies
tpt-yaml-serdeimplemented, unreleasedserde Deserializer/Serializer over tpt-yaml-core's arena, a dynamic Value type, and a constant-memory streaming Deserializer
tpt-yaml-editimplemented, unreleasedLossless, span-preserving edits: change a value, re-render only the touched subtree
tpt-yaml-schemaimplemented, unreleasedJSON Schema (2020-12 subset) validation for parsed YAML documents
tpt-yaml-cliimplemented, unreleasedtpt-yaml binary: check, fmt, convert, diff subcommands
tpt-yaml-ffiimplemented, unreleasedC ABI foundation for language bindings
tpt-yaml-pythonimplemented, unreleasedpyo3 bindings: loads/dumps/TptYamlError, verified with maturin develop
tpt-yaml-wasmimplemented, unreleasedwasm-bindgen bindings for the browser/Node.js: parse/toJson/stringify

Each crate has its own README.md (usage, design, known limitations) and CHANGELOG.md. None have been published to crates.io/PyPI/npm yet — see todo.md §7 for release-readiness status and publish order.

Quick start

let doc = tpt_yaml_core::parse("key: value\nlist:\n  - a\n  - b\n")?;
let root = doc.root().unwrap();

Or process a document as a constant-memory stream of events, without building the arena at all:

let mut parser = tpt_yaml_core::stream::events("key: value\nlist:\n  - a\n  - b\n");
while let Some(event) = parser.next_event()? {
    // handle Event::MappingStart, Event::Scalar, Event::SequenceEnd, ...
}

Status

This is pre-1.0, under active development. See todo.md for the detailed build checklist and current status snapshot.

Publish order

Crates depend on each other in this order, so that's the order they'll be published in:

  1. tpt-yaml-core
  2. tpt-yaml-serde
  3. tpt-yaml-edit
  4. tpt-yaml-schema
  5. tpt-yaml-cli
  6. tpt-yaml-ffi

License

Licensed under either of Apache License, Version 2.0 or MIT license at your option.