Skip to content

v0.5.0: empty default features + TOON spec v3.1 + faster float emit - #20

Merged
coseto6125 merged 2 commits into
mainfrom
chore/cli-default-no-python
Jun 2, 2026
Merged

v0.5.0: empty default features + TOON spec v3.1 + faster float emit#20
coseto6125 merged 2 commits into
mainfrom
chore/cli-default-no-python

Conversation

@coseto6125

Copy link
Copy Markdown
Owner

What

Three independent threads, landed together as v0.5.0 (the spec-alignment changes are breaking output changes, hence the minor bump).

1. cargo install no longer needs --no-default-features

default features are now empty, so the CLI binary builds without pulling in pyo3. The Python wheel enables python explicitly via maturin ([tool.maturin] features). Removes the redundant --no-default-features from CI, release, and cargo publish.

2. TOON spec v3.1 alignment (default on)

  • Empty arrays → canonical [] / key: [] (was [0]:); a bare empty-array element keeps - [0]: per SPEC §9.2.
  • Control chars U+0000–U+001F → \uXXXX (lowercase), named \n \r \t preserved.
  • Key folding restarts at any multi-key object (§13.4), not just top level — without re-folding past flattenDepth / sibling-collision stops.
  • Encode fixtures synced to official toon-format/spec v3.1 (+7 cases); key-folding.json keeps the sigil-prefix extensions + 2 deep-fold regression cases.

Both empty_array_bare and escape_controls are options (default true); pass false for legacy output.

3. Faster float emit (~1.7x)

write_number dropped a redundant to_string() probe that formatted every float twice before write_float.

Verification

  • 17 new Rust unit tests (number canonicalization, empty-array forms, control escaping, depth folding); CI now runs cargo test.
  • 159 spec fixtures pass.
  • benches/compare.py (+ Node sidecar) compares etoon vs toons / py-rtoon / TS SDK on speed and byte-identical parity.
    MSG | etoon

E-NoR added 2 commits June 2, 2026 13:34
…er float emit

CLI / packaging:
- default features now empty so `cargo install etoon` builds the binary
  without pulling in pyo3; the Python wheel enables `python` explicitly via
  maturin (pyproject [tool.maturin] features). Drops the redundant
  `--no-default-features` from CI / release / cargo publish.

Spec v3.1 alignment (default on; breaking output change → 0.4.1 → 0.5.0):
- empty arrays emit canonical `[]` / `key: []` (was `[0]:`); a bare empty
  array *element* keeps `- [0]:` per SPEC §9.2.
- control chars U+0000–U+001F escape to `\uXXXX` (lowercase hex), keeping
  named `\n \r \t`.
- key folding now restarts at any multi-key object (SPEC §13.4), not just the
  top level, without re-folding past flattenDepth / sibling-collision stops.
- encode fixtures synced to the official toon-format/spec v3.1 set (+7 cases);
  key-folding.json keeps etoon's sigil-prefix extensions + 2 deep-fold cases.

Performance:
- write_number drops the redundant to_string() probe before write_float;
  float-heavy emit ~1.7x faster (probe formatted every float twice).

Tests / tooling:
- 17 Rust unit tests pinning number canonicalization, empty-array forms,
  control escaping, and depth folding; CI runs `cargo test`.
- benches/compare.py + ts_bench.mjs: etoon vs toons / py-rtoon / TS SDK,
  speed + byte-identical parity.
…chmark

Replaces the single hand-timed 50-doc snapshot with the benches/compare.py
numbers across four payload shapes, comparing etoon (PyO3) vs toons / py-rtoon
/ TS SDK on both speed and byte-identical parity (py-rtoon's `0.0` spec
deviation is now visible). Reproduce section points at `benches/compare.py`
(+ the `.[bench]` extra) instead of an ad-hoc shell loop. Both EN and zh-TW.
@coseto6125
coseto6125 merged commit a99ed8d into main Jun 2, 2026
5 checks passed
@coseto6125
coseto6125 deleted the chore/cli-default-no-python branch June 10, 2026 04:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant