Repository navigation
Releases
v0.18.0
Adopts omnist-spec v0.36.0-beta (vendor/omnist-spec moves from v0.35.0-beta;
the suite grows from 731 to 793 vectors, 28 OSD-OML vectors skipped, nothing
else). One behaviour change a caller can observe.
- Breaking: JSON text with a bare
NaN,Infinityor-Infinitytoken is
parse.codec-syntax(C-19, DIV-45). CPython'sjsonmodule reads the three
tokens as non-finite floats, soread_json('{"a": NaN}')used to succeed.
JSON has no such token. YAML (.nan,.inf), TOML and OML (nan,inf)
still spell them, and a number literal beyond binary64 (1e999) still reads
as an infinity (D-29). The error path is1:1: the decoder does not report
where the token is. Migration: write the value as a string, or as a
literal in a format that spells it. - Runner: two NaN leaves compare equal (E-33, DIV-47).
tools/conformance
compared the parsed Document with the library's equality, in which a NaN is
not equal to itself, so the threenan-is-a-numbervectors failed whatever
the reader returned. The referee now walks the two nodes and treats two NaNs
as equal; the library equality is untouched. - Checked and clean: XML pretyping (C-18, D-28, D-29). The
integerand
numberforms already follow C-18, anintegerover 4300 digits is
document.limit.int-digitsat the leaf, and anumberreads past binary64 as
an infinity. The grammar check runs before any big-integer or float parse, so
1 to 8 MB leaves of99...9x,-99...9x,99...9.and99...9eare
refused in linear time (8 MB: 0.3 s for anintegerleaf, 1.2 s for a
numberleaf). Pinned bytests/test_spec_v036.py. - Vectors. Track 1 (fixtures) 19 of 19; Track 2 (vector suite) 759 passed
and 6 failed before the fix, 765 passed and 28 skipped after.
v0.17.1
Bug-fix release; vendor/omnist-spec stays at v0.35.0-beta. One behaviour
change a caller can observe.
- A YAML or TOML time or datetime fraction past six digits fails (#366).
PyYAML andtomllibcut the fraction to six digits without a word:
00:32:00.9999999read as.999999and
2024-01-15T12:00:00.000000001+01:00as12:00:00. The Document holds
microseconds at most, so a non-zero digit past the sixth is now
parse.codec-syntaxat the literal (line:col, like the readers' other
syntax errors); zeros past the sixth are dropped; an offset is kept, never
converted. Migration: shorten the literal or quote it to read it as a
string. - Checked and clean. JSON and XML keep the text verbatim; OML refuses a
seventh digit as a syntax error. No writer can emit a fraction its reader
refuses: a Pythontime/datetimeholds microseconds, so.999999is the
widest value a writer is handed (round trips pinned for OML, YAML and TOML;
thecheck_*paths report noformat.temporal-stringified). Hostile input,
timed and linear, nothing to fix: a 4 MB hex, octal or binary integer
literal is refused asdocument.limit.int-digits(TOML 0.5 to 1.0 s, YAML
about 2.2 s; 8 MB about 2 to 5 s), an 8 MB XML attribute reads in 0.1 s, XML
depth 1k to 100k isdocument.limit.depthin under 0.1 s, and OML with
100,000"fails in 0.04 s. docs/design/cli-spec.md: broken§1aanchor (#339). The link used
#1a-json-machine-mode-shared; mkdocs slugifies the heading
## 1a. \ (machine mode, shared)to1a---json-machine-mode-shared.
mkdocs build --strictno longer reports it.- #350 needs no code change. All five items already shipped: coded
--jsonerrors and the documented residual uncoded cases (0.13.0), the
runner identity check (0.13.0), success-path diagnostics comparison
(0.13.0), the lone-surrogate writer refusal (C-9, 0.14.0) and the XML
re-check comment.
v0.17.0
A minor bump under the beta rule. vendor/omnist-spec moves from
v0.34.0-beta to v0.35.0-beta (237ef00).
Conformance, before any fix (from the pin bump alone): Track 1 19/19; Track 2
666 passed, 37 failed, 28 skipped of 731. After: Track 1 19/19; Track 2 703
passed, 0 failed, 28 skipped of 731 (the 28 OSD-OML skips, nothing else).
- E-36: a Document path quotes a label that needs it. A label that is
empty or holds.,[,],",\, a control character, U+007F, U+0085,
U+2028 or U+2029 prints as["label"]with the pinned escapes (lowercase
\uXXXX); every other label stays.label. This applies to every path in a
report, error orDoc.path. Migration: a label that is not a plain
identifier but is otherwise safe (a b) used to print as$["a b"]for a
Docbuilt from a Python mapping and now prints$.a b. - E-37: temporal writers. TOML writes a
datetimewith theTseparator
and atimewith an offset as a double-quoted ISO-8601 string with
format.temporal-stringified(it used to raiseValueError). YAML writes a
datetimewithTand atimeas a double-quoted string
(format.temporal-stringified). - C-14: YAML escapes are lowercase (
\x1f,\x7f,\x80,�,
�). - Fixed the
read_yamldocstring, which gave0o7777as a four-digit YAML
octal (PyYAML reads0o17as a string; the spelling is07777). - Performance: reading 100,000 flat keys, median of 7 alternating runs against
v0.16.0 on a noisy shared machine: JSON 514 ms (v0.16.0) vs 515 ms, XML
616 ms vs 606 ms, so no measurable cost. An ASCII-identifier fast path in the
label-quoting check keeps the common label to oneisidentifiercall. (The
slowdown reported against v0.15.x was not reproducible against v0.16.0.)
v0.16.0
A minor bump under the beta rule: inputs that used to be accepted are now
refused (a repeated YAML key, !!pairs/!!omap/!!set), and the safety
limits become options. vendor/omnist-spec moves from v0.33.0-beta to
v0.34.0-beta (3346b50). Closes omnist#359 and omnist#360.
Conformance, before any fix (from the pin bump alone): Track 1 19/19; Track 2
429 passed, 17 failed, 76 skipped of 522. After: Track 1 19/19; Track 2 494
passed, 0 failed, 28 skipped of 522 (the 28 OSD-OML E-20/E-21 skips, nothing
else).
- C-12: a YAML mapping that repeats a key is
parse.codec-syntax, at the
line and column of the second occurrence (it used to read last-wins). A key a
merge key supplies is not a repeat. TOML already refused; JSON keeps the last
value at the first position (C-11, now pinned by tests). - C-13:
!!pairs,!!omapand!!setare refused with the new code
format.tag-forbiddenat path$(they surfaced as
document.unlabeled-element, or were accepted). - Configurable safety limits (DIV-28, omnist#360). Every reader and
Doc.from_*takesmax_depth(ceiling 200),max_nodes(ceiling
10 000 000) andmax_int_digits(ceiling 4300) per call, like
max_input_bytes;Doc.from_formatpasses them when given. The Track 2
runner honoursdeclared_max_*, so the 48 limit vectors no longer skip. - Integer-digit refusals carry the literal's Document path (DIV-29, E-4a).
JSON, YAML, TOML and OML reported$for a literal past CPython's own
conversion guard; they now report e.g.$.o.a[1]. D-28: the digits of the
value are counted, so0xFFFand1_000have four. The XML pretyping of an
over-limit integer isdocument.limit.int-digitsat the leaf path instead of
an uncaughtValueError. - Behaviour changes to note. The JSON/YAML/TOML integer-digit refusal is a
DocumentError(as every other build-time limit), where a literal past 4300
digits was aParseError; OML staysParseError. Migration: catch
OmnistError(the base of both), or both classes; the spec fixes the code and
path, not the exception class.format.tag-forbiddenis aParseError, like
format.dtd-forbidden. A scalar now counts as a level in OML and XML, as in
the builder (D-12): a document nested exactly 200 levels still reads; only a
leaf at depth 201 in OML or XML is newly refused (JSON, YAML and TOML are
unchanged). XML counts nodes as
every other format does (the root and elements with children, not leaf
elements). A YAML timestamp that is not a date (2001-13-45) is
parse.codec-syntax, no longer mislabelleddocument.limit.int-digits. - D-29 (a literal beyond binary64 reads as an infinity, underflow as
0.0)
already held in JSON, YAML, TOML and OML; now pinned by tests. - Runners. Track 1 compares a lint finding's
codeexactly (omnist#359,
spec section 8.3 is mandatory); stale runner comments updated. Track 2 passes
compactto the OML writer (E-35).
v0.15.0
A minor bump under the beta rule: the XML writer now rejects an input it
used to accept (see "Behaviour changes"). vendor/omnist-spec moves from
v0.32.0-beta to v0.33.0-beta (64cbb68). Conformance: Track 1 19/19;
Track 2 333 passed, 0 failed, 34 skipped of 367 (28 OSD-OML, 6 limits E-20,
unchanged); from the bump alone 4 vectors failed (the formats-xml/nulls
write vectors; the fifth, the read-side neighbour, already passed).
- C-10: an XML null leaf fails the write.
write_xml,check_xml,
Doc.to_xmlandomnist convert --to xmlraiseWriteError
(write.unsupported-value), unconditionally and regardless ofstrict, at
the Document path of the null leaf, with the E-10 index when its label
repeats ($.root.item[1]). XML has no null token and<a/>reads back as
the empty string, so the old output was indistinguishable from the different
Document holding"". Thenull.omittedadjustment for XML, its docs and
its tests are gone. Closes the Python row of ledgerDIV-21. - E-10 on the XML reader's drop paths (omnist#357).
format.attribute-droppedandformat.namespace-droppednow carry the index
on every occurrence of a repeated element (<r><a x="1"/><a x="2"/></r>
reports$.r.a[0]and$.r.a[1], not$.r.atwice); built with the shared
edge_pathshelper. A lone element is unchanged. - Docs:
docs/formats/toml.mdstill described a TOML null as dropped with
null.omitted; it has failed unconditionally since #324. Corrected.
Behaviour changes
- Writing a Document with a null leaf to XML used to succeed with a
null.omittedwarning (an empty element) and now fails. Callers that relied
on it must remove or replace the null before writing.
v0.14.0
A minor bump under the beta rule: new behaviour, a new default limit and
new rejections (see "Behaviour changes" below). vendor/omnist-spec moves from
v0.28.0-beta to v0.32.0-beta (634ff12). Conformance: Track 1 19/19;
Track 2 328 passed, 0 failed, 34 skipped of 362 (28 OSD-OML, 6 limits E-20,
unchanged); from the bump alone 22 vectors failed (5 repeated-label paths, 7
OML-29, 10 input-size). Divergence-ledger entries closed: DIV-14, DIV-17,
DIV-18; the C-9 row of DIV-5 is met by this release too.
- E-10: the index is on every occurrence of a repeated label (v0.30). A
Document path carries[i]on every edge whose label occurs more than once
in its node, the first included ($.item[0]), and none on a label that
occurs once. One builder (omnist/_paths.py) now servesDoc.edges,
validate,materializeand every writer path; the five copies of the old
if i == 0branch are gone. - D-23/D-24: a maximum input size (v0.30). Every reader (
read_oml,
read_json,read_yaml,read_toml,read_xml),Doc.from_*and the CLI
refuse an input of more thanmax_input_bytesbytes with
document.limit.input-sizeat$, before decoding and before any parsing;
an input of exactly the maximum is accepted, bytes (not characters) are
counted, a leading BOM included. The default is 64 MiB
(67_108_864): D-24 gives no reference default, and this one is large
enough for any real document while keeping the worst case of the slowest
codec (PyYAML, seconds per megabyte) from becoming unbounded. The CLI takes
--max-input-bytes N(a file or stdin is read at most one byte past the
maximum); OSD schema files are not Documents and are not
bounded. The option is validated like the other limits:0, a negative
number, aboolor a non-int raiseValueError/TypeError(no ceiling). - OML-29: a gap after the colon (v0.31).
a:newline1,a: ;1,
a: # cnewline1anda:newline{b: 1}are valid, at top level and
inside braces. A missing separator between edges is still an error
(a:newline1 b: 2isparse.trailing-contentat2:3). - C-9: no writer writes a string with no UTF-8 encoding (v0.32). JSON,
YAML, TOML, XML and OML fail withwrite.unsupported-value,
unconditionally, on a string value or an edge label that is a lone surrogate
or a surrogate-escape artefact (U+DC80..U+DCFF), fromwrite_*,check_*
andDoc.to_*; never as an escape. The path is the node holding the string:
the leaf for a value (indexed per E-10), the node holding the edge for a
label (XML included: it no longer reports the label's edge path). Readers are
untouched. The omnist#350 repro,write_jsonofread_jsonof a document
whose one string is the escape for U+D800, now fails
at$.a; this was the "Not done" item of 0.13.0. - omnist#354: a top-level braced node is rejected.
{a: 1}as a whole
document was accepted although §4.6's three legal shapes exclude it. It now
fails withparse.unexpected-tokenat the{(1:1), the code and
position Go and Java report. Braces are unchanged below the root
(x: {a: 1}). - CLI
--max-input-bytes Non every subcommand that reads a Document
(format,convert,check,validate,infer): the same limit as the
library option, validated the same way (an integer of at least 1, else a usage
error); the refusal says "use --max-input-bytes to raise it". Additive. - Conformance runner. Understands
declared_max_input_bytes(library path,
optionmax_input_bytes); any other unknowndeclared_*key still fails the
vector (E-20a), and so does a known one on an operation that does not honour
it (onlyparsedoes). - Behaviour changes. (1) An input above 64 MiB is now refused, not parsed;
raisemax_input_bytesto keep reading one. (2) Paths of a repeated label's
first occurrence changed ($.ato$.a[0]) in diagnostics,WriteError.path
and report entries. (3) A top-level{...}OML document is now a parse
error. (4) A string with no UTF-8 encoding now fails every writer (JSON,
TOML and OML used to emit it raw, YAML an escape). (5) Public signatures
gained the keyword-onlymax_input_bytes(additive). - Pin.
vendor/omnist-specis a gitlink to634ff12(tag
v0.32.0-beta);.gitmodulesis unchanged. Version strings in
tests/test_canonical.py,tests/test_docs.py,docs/api.mdand
docs/cli.mdmoved to0.14.0.
v0.13.0
A minor bump under the beta rule: public error codes appear on failures
that used to carry none, so omnist --json fills errors for them. Follow-ups
from the review of #349. No spec change: vendor/omnist-spec stays at
v0.28.0-beta. Conformance is unchanged: Track 1 19/19, Track 2 304 passed,
0 failed, 34 skipped of 338.
document.limit.depthon every depth refusal. A nesting-depth refusal
from a writer orcheck_*,Doc.to_data/to_grouped,inferand
Schema.validatewas an uncodedWriteError/DocumentError; it now carries
code="document.limit.depth",path="$"(the readers already did).write.unsupported-valuefor a bare scalar root written as TOML (the
spec says a bare scalar Document cannot be written as TOML),path$.- Verified, no change needed. A self-referential YAML anchor already gives
document.limit.alias-expansion(D-20, since #352); the JSON NaN/Infinity
refusal already giveswrite.unsupported-value. #344 was fixed in 0.12.0. - Still uncoded, on purpose (the spec registers no code): a self-referential
Python value (cycle detected), a non-Document value type,DocAPI misuse,
and astrict=Truerefusal. Their--jsonpayload haserrors: []and a
message, which is always present; documented indocs/api.mdand
docs/cli.md. - Conformance runner.
check_version()now also compares the module file the
CLI's own interpreter imports with this checkout's (the same version number
from another install is refused). Success-path diagnostics are compared for
everyok: trueoperation (validate,materialize, OMLparse/write,
parse_schema,extract, as the codecs already were): where the CLI has no
channel the reported set is empty, so an expected diagnostic fails instead of
passing unchecked.materializenow passes--report. - Docs. A comment on
_xml_well_formedrecords why its handler-less
re-check parser is unreachable with a DTD today. - Not done: a lone surrogate in a string value written through the
str
API (write_json(read_json('{"a":"\ud800"}'))) still yields text that does
not encode to UTF-8. The spec leaves it open (D-14 puts it out of scope);
waiting on a spec ruling. - Version strings in
tests/test_canonical.pyandtests/test_docs.pymoved to
0.13.0.
v0.12.0
A minor bump under the beta rule, and all five ports take a minor for this
spec version: new public error codes (schema.invalid-label,
schema.invalid-name at $), inputs that used to be accepted are now rejected
(bad names and labels, [0,0] in the writer), and infer derives record names
differently. vendor/omnist-spec moves from
v0.27.0-beta to v0.28.0-beta. No conformance vector pins these rules
(divergence ledger DIV-5), so tests/test_schema_programmatic.py is the only
pin. Conformance is unchanged: Track 1 19/19, Track 2 304 passed, 0 failed,
34 skipped of 338.
schema.invalid-label(S-22). A field label that does not encode to
UTF-8 (a lone surrogate such as"a\udc80") raisesSchemaErrorwhen the
Schemais built, at the record path (never the label), also for OSD text
decoded from a string holding one.to_osd()re-checks every label it
writes, so aFieldappended to a record after theSchemawas built is
caught there too.FieldandRecorddo not check: the record name, hence
the path, is unknown to them.to_osd()used to emit such a label.schema.invalid-name(S-8), programmatic. A record name orReftarget
that does not match[A-Za-z_][A-Za-z0-9_]*(for example"bad name")
raisesSchemaErrorat$, with the name in the message only.Ref(...)
checks its own name;Schema(...)checks everyenvkey.[0,0]is refused by the OSD writer (S-15, OSD-16, S-24).to_osd
raisesWriteError(write.unsupported-value, path the record) for a field
withmax = 0; it used to write"a" [0]: string, which no reader accepts.
The model still accepts[0,0].prune()drops such fields except from an
unsatisfiable root, so no algebra operation produces one; prune before
writing.- S-23 cannot arise. There is no caller-supplied record ordering in the
API (to_osdtakes onlyindent), soschema.unknown-recordis never
raised. There is no OSD-OML schema writer in this port. inferrecord names are valid names. Labels with accented letters,
non-ASCII digits or only digits ("\u00e9","123") used to give a record
name S-8 rejects; names are now ASCII-only and fall back toRec.- Tests and fixtures needing a change: none; no existing test built a name or
label these rules forbid. The0.11.0version asserts in
tests/test_canonical.pyandtests/test_docs.pymoved to0.12.0.
v0.11.0
A minor bump under the beta rule: a new public option, a denial-of-service
fix and new error codes. vendor/omnist-spec moves from v0.22.0-beta to
v0.27.0-beta (v0.23 to v0.27). Python was the last port without the spec's
alias rules; the divergence ledger's DIV-3 closes with this release.
read_yaml/Doc.from_yamltakemax_alias_expansion(default 50, at
most 10 000) andmax_expanded_slots(default 1 000 000, at most
10 000 000). The anchor/alias graph is composed, measured in one iterative
pass and only then constructed, so a "billion laughs" input is refused in
milliseconds before any alias is expanded. Every mapping and sequence,
anchored or not, the root and inline merge sources included, is a candidate
(D-18); a merge sequence is a carrier, anchored or not (D-18a); an input with
an alias or merge key whose total expansion is over the size cap is refused
(D-22), an alias-free input never is (the cliff is deliberate). New codes
document.limit.alias-expansionanddocument.limit.expanded-size, path
$, raised asDocumentError. Options are validated: a non-intis a
TypeError, a value outside1 .. ceilingaValueError(so0raises, as in omnist-j; the TypeScript, Go and Rust
ports read0as "use the default"). The CLI, the
registry andDoc.from_formatuse the defaults. Seedocs/formats/yaml.md.- Behaviour changes to documents that used to read. Input with an
expansion factor over 50 (for example a mapping that merges a block of more
than 148 keys and writes one key of its own, or a 100-key block aliased 100
times at the root) is now refused; raisemax_alias_expansionfor such a
file. A self-referential anchor isdocument.limit.alias-expansion(it was an
uncoded "cycle detected", or silently accepted fora: &a {<<: *a}). - Malformed merges are
parse.codec-syntaxat the node's line and column
(<<: 1,<<: [1],<<: [[{a: 1}]],<<: *sover scalars), before any
limit is counted.<<: [](and<<: *sover an
empty sequence) is a well-formed carrier that merges nothing and is accepted
(v0.27.0-beta). A container used as a mapping key is counted like a value (the
spec is silent; PyYAML refuses the unhashable key later, so only the reported
error differs). - A redefined anchor now reads (the latest definition applies, as in
YAML 1.2); PyYAML alone refused it asparse.codec-syntax. - Runner: E-32's
line:colplaceholder, the alias vectors run with their
declared maxima through the library, andnormalize/prune/extract/
parse_schemacompare canonical text byte for byte, trailing newline
included. The vendored suite is 338 vectors; the pin changes were otherwise already satisfied (BOM and invalid
UTF-8, E-27, codec positions, OML-26/27/28, canonical comparison).
v0.10.1
A patch bump under the beta rule: one narrow parse-error-code change and
runner hardening, nothing else. vendor/omnist-spec moves from v0.21.0-beta
to v0.22.0-beta. Codec (JSON/YAML/TOML/XML) syntax positions are untouched
(omnist-spec#114) and unterminated arrays are untouched (omnist-spec#115).
- OML-26 / OML-25 / OML-27. After a complete top-level edge (or scalar
document), any leftover token that cannot continue the edge list is
parse.trailing-contentat that token, with or without a separator before it.
The list continues only if a separator is followed by a STRING or IDENT
(which then is the next edge and reports its own error, e.g.null: 2is
parse.reserved-word-label). Before,a: 1LF],,,:,{,[2],
5,nanand the like wereparse.unexpected-token. Inside{...}and
[...]nothing changes (OML-27). - E-28 / E-29. OML and OSD columns already counted code points and a line
ended at LF (CRLF one break); tests now pin a combining mark, a tab, BMP
non-ASCII, an astral character and CRLF. - Runner: the CLI runners now fail loudly (exit 2) when
omnist --version
does not matchomnist.__version__(omnist#350 item 2), so a staleomnist
onPATHcan no longer be measured by mistake.
Conformance, before and after (track 1 stays 19 / 0 / 0, referee self-test
10 / 10):
| step | pass | fail | skip |
|---|---|---|---|
| new pin (287 vectors), library untouched | 240 | 7 | 40 |
| + OML-26 with a separator | 247 | 0 | 40 |
The 40 skips are unchanged (28 OSD-OML omnist#341, 6 limits, 6 alias-expansion
DIV-3).