v0.1.0 — Initial release
Initial release 🎉
Fast TOON (Token-Oriented Object Notation) encoder for Python, Rust, and CLI. Byte-identical to the TOON spec, 8× faster than toons, 2.7× faster than the official TypeScript SDK.
Performance (neptune 50-doc payload, 7480 bytes JSON → 4012 bytes TOON)
| Encoder | Time | Relative |
|---|---|---|
| etoon (Python) | 13.0 μs | baseline |
| @toon-format/toon (TS SDK, Node) | 35.6 μs | 2.73× slower |
| py-rtoon | 85.9 μs | 6.6× slower |
| toons | 106.4 μs | 8.2× slower |
CLI via stdin pipe (Claude Code / Bash agents):
- etoon: 0.57 ms/call
- official
toonCLI: 50.7 ms/call (89× slower due to stdin heuristics)
Architecture
Python dict → orjson.dumps → JSON bytes → sonic-rs (SIMD parse) → TOON emitter → String
Key optimizations:
- sonic-rs SIMD JSON parser (~7× faster than serde_json)
- orjson bridge — single PyO3 boundary crossing
- uniform-order table fast path — skips 300 key lookups on typical tabular payloads
- itoa specialized integer formatting
- 111/111 TOON spec fixtures passing (Apache-2.0 from
toons)
Install
pip install etoon # Python (13μs in-process)
cargo add etoon --no-default-features # Rust library
cargo install etoon --no-default-features # Rust CLI from sourceCLI binaries for Linux/macOS/Windows below ↓
Compatibility
Output is byte-identical to the toons Python package and the official toon-format/toon TypeScript SDK. Drop-in replacement for both on the Python side.
Limitations
- Integers > 2⁶³ coerced via f64 (arbitrary precision not supported)
- Custom
indenthardcoded to 2 spaces (TOON spec default) - Advanced spec features (delimiter/fold_keys) coming in v0.1.2
License: Apache-2.0 (test fixtures sourced from toons, also Apache-2.0)