Skip to content

v0.2.0

Latest

Choose a tag to compare

@xaviviro xaviviro released this 29 Sep 07:40
· 2 commits to main since this release

Release Notes - v0.2.0

Overview

This release brings python-toon in line with TOON spec 4.1. The encoder and decoder have been rewritten and pass the full conformance fixture suite of the official toon-format/spec.

python-toon is an unofficial implementation; the official projects live in the toon-format organization.

New Features

  • Nested field groups: uniform nested objects collapse into the tabular header, e.g. orders[2]{id,customer{name,country},total}:
  • Keyed tabular form: objects whose values share one shape encode as a table, e.g. servers[2:]{host,port}:
  • Decoder: full-line # comments, BOM and CRLF input, UTF-8 byte input
  • Strict mode: full spec §14 checklist (counts and row widths, blank lines inside arrays, duplicate keys, malformed headers, trailing content); non-strict mode resolves duplicate keys last-write-wins
  • Normalization: dataclasses, mappings, frozenset and datetime.time

Breaking Changes

  • Tabular headers no longer include the comma: items[2]{id,name}: instead of items[2,]{id,name}:
  • Empty arrays encode as key: [] (and [] at the root)
  • Numbers use canonical form: plain decimals for 1e-6 ≤ |n| < 1e21, exponent form (1e-7, 1e+21) outside that range
  • Strings starting with # are quoted
  • The # length marker was removed from the spec: the lengthMarker option is deprecated and ignored, --length-marker was removed from the CLI, and [#N] is no longer decoded
  • ToonDecodeError now subclasses ValueError

Bug Fixes

  • List-item objects whose first field is nested now put that field on the hyphen line, so they decode back correctly (#4)
  • Keys with a trailing newline are quoted

Testing

  • 621 tests passing on Python 3.8 to 3.12, including all 538 official spec fixtures (vendored in tests/fixtures/)
  • Seeded random round-trip tests across all delimiters

Installation

pip install --upgrade python-toon