Up to [cvs.NetBSD.org] / pkgsrc / textproc / py-tomlkit
Request diff between arbitrary revisions
Keyword substitution: kv
Default branch: MAIN
py-tomlkit: update to 0.15.2.
Changed
Write the ESC control character as \u001b instead of \e, which is only valid in TOML 1.1, so the output stays readable by TOML 1.0 parsers such as tomllib. (#641)
key_value() now raises UnexpectedCharError on anything other than whitespace or a comment after the pair, instead of silently discarding it (e.g. key_value("a = 1 b = 2")), matching parse(). (#594)
integer() given a string now validates it against the TOML integer grammar and keeps the original text, so grouping underscores (e.g. integer("1_000")) survive dumps(); strings that are not valid TOML integers (e.g. "010") now raise ValueError. (#336)
Add a fold argument to DateTime and Time, mirroring the stdlib, and carry fold through item(), arithmetic (including datetime subtraction) and unwrap(), so a folded local time no longer converts an hour off. (#619, #623, #626)
Declare the project metadata in the PEP 621 [project] table; building from source now requires poetry-core>=2.2.0. (#607, #609)
Fixed
Fix valid TOML being rejected when an out-of-order table reopens an implicit super-table with a dotted key: [a.b.c] then [a] with b.z = 1 extends the implicit a.b super-table rather than redefining it (stdlib tomllib accepts it), so it now parses and round-trips instead of raising Redefinition of an existing table. The concrete-table case ([a.b] then [a] b.z = 1) stays rejected. (#565)
Fix uppercase E exponent after a leading-zero mantissa (e.g. 0E2) being rejected as an invalid number while 0e2 parsed fine. (#586)
Fix non-lowercase special floats (e.g. Inf, NaN, -INF) being accepted; TOML only allows lowercase inf and nan, so they now raise ParseError. (#628)
Fix parse errors reporting the wrong line and column in documents with CRLF or mixed line endings. (#642)
Fix item() reordering the keys of an inline table (dict-valued keys were forced last) under the default sort_keys=False. (#546)
Fix unwrap() moving a key to the end after its value was replaced (e.g. doc["b"] = 9), while dumps() and keys() kept the original order. (#591)
Fix appending a key to a parsed inline table that uses ", " separators emitting a bare "," for the new entry, leaving the table inconsistently spaced (e.g. {x = 1, y = 2,z = 3}). (#595)
Fix an emptied array of tables being dropped from the output: it now renders as key = [], placed and keyed relative to the nearest table header so it parses back into the same table. (#567)
Fix a single-line array whose last element is a trailing comment (e.g. from add_line(value, comment=...)) rendering its closing ] on the comment line, producing unparseable output. (#580)
Fix del array[start:stop:step] with a negative or omitted bound removing the wrong elements from the rendered output. (#599)
Fix array slice assignment mutating the array before raising ValueError("slice assignment is not supported"). (#600)
Fix String.__add__ splicing the appended text into a basic string without escaping it, so appending a quote or backslash produced invalid TOML. (#612)
Fix a bare carriage return in a multiline string producing invalid TOML: it is now escaped as \r in a multiline basic string and rejected with InvalidStringError in a multiline literal string; CRLF line endings are left intact. (#539)
Fix a tz-aware datetime.time rendering with a UTC offset (e.g. 07:32:00+02:00), which TOML local times do not allow; it now renders as a local time. (#613)
Fix arithmetic on a signed float producing +-0.0 (e.g. -1.5 times 0), which does not parse. (#629)
Fix two Bool items never comparing equal to each other; they now compare by value. (#660)
py-tomlkit: update to 0.15.1.
## [0.15.1] - 2026-07-17
### Changed
- Speed up membership tests (`key in ...`) on `Container`, `Table` and `InlineTable` with native `__contains__` implementations, avoiding the inherited `MutableMapping` round-trip through `__getitem__` (which resolves the value and builds an exception on every absent key). ([#483](https://github.com/python-poetry/tomlkit/issues/483))
- Speed up parsing by making `Source` index-based: it now tracks an integer position over the input string instead of materializing a list of `(index, char)` tuples up front, so construction is O(1) and state save/restore no longer copies an iterator. ([#489](https://github.com/python-poetry/tomlkit/pull/489))
- Speed up parsing by scanning character runs in bulk: `Source.advance_while`/`advance_until` consume a whole run of whitespace, bare-key or number characters in a single pass over the input string instead of one `inc()` call per character. ([#490](https://github.com/python-poetry/tomlkit/pull/490))
- Speed up parsing of single-line strings by bulk-appending the run of ordinary characters up to the next delimiter, backslash or control character in one pass, instead of one character at a time. ([#491](https://github.com/python-poetry/tomlkit/pull/491))
- Speed up parsing by removing the internal `TOMLChar` wrapper: the parser now reads plain `str` characters from `Source` and detects end-of-input positionally, avoiding a per-character object construction and method dispatch. ([#492](https://github.com/python-poetry/tomlkit/pull/492))
- Speed up parsing by comparing `StringType` members by identity (`is`) instead of building a set on every `is_basic`/`is_literal`/`is_singleline`/`is_multiline` call, avoiding millions of enum hashes while parsing. ([#502](https://github.com/python-poetry/tomlkit/pull/502))
- Speed up merging super tables by merging in place instead of deep-copying the growing target on every merge, turning the parse of documents with many subtables under a shared super table (e.g. consecutive `[a.b.c]` / `[a.b.d]` headers) from O(n²) into O(n). ([#503](https://github.com/python-poetry/tomlkit/pull/503))
- Speed up membership tests (`key in ...`) on out-of-order tables with a native `OutOfOrderTableProxy.__contains__`, completing [#483](https://github.com/python-poetry/tomlkit/issues/483) for the last mapping type that still inherited the slow `MutableMapping` mixin (which resolves the value and builds an exception on every absent key). ([#515](https://github.com/python-poetry/tomlkit/pull/515))
- Speed up parsing documents with many dotted keys or table headers sharing a prefix by validating out-of-order tables incrementally: each new fragment is merged into a cached validation container once, instead of re-merging (and deep-copying) every earlier fragment on each append, turning a super-cubic worst case into linear time (80 shared-prefix dotted keys: ~8 s → ~10 ms). ([#479](https://github.com/python-poetry/tomlkit/issues/479))
- Speed up parsing of arrays that close right after a value (e.g. the `files = [...]` blocks that dominate lock files): the parser no longer attempts to read a value while sitting on the closing `]`, which previously built an `UnexpectedCharError` just to discard it — and constructing that exception eagerly computes a line/column by scanning the whole document, making it O(document size) per such array. ([#517](https://github.com/python-poetry/tomlkit/pull/517))
- Speed up parsing of multiline strings by bulk-appending the run of ordinary characters — across raw line feeds and tabs — up to the next delimiter, backslash, carriage return or control character, instead of one character at a time. This extends to `"""`/`'''` bodies the single-line fast path added in [#491](https://github.com/python-poetry/tomlkit/pull/491); a `\r` still stops the scan so `\r\n` stays validated and byte-for-byte preserved. ([#518](https://github.com/python-poetry/tomlkit/pull/518))
- Speed up `unwrap()` (converting a parsed document to a plain `dict`) by resolving each key directly from the container's key map instead of iterating the inherited `MutableMapping` view, which rebuilt a `SingleKey` from the bare string for every key just to re-look-up the value. Out-of-order tables still resolve through their proxy, so their validation is unchanged. ([#521](https://github.com/python-poetry/tomlkit/pull/521))
- Speed up rendering (`as_string()` / `dumps()`) of inline tables with many keys by precomputing the last-key and last-deleted-element indices in a single pass, instead of rescanning the remaining body on every separator comma — turning an O(n²) render into O(n). ([#525](https://github.com/python-poetry/tomlkit/pull/525))
- Raise on malformed array element instead of dropping it, ([#527](https://github.com/python-poetry/tomlkit/pull/527))
### Fixed
- Fix `string()` dropping a leading newline of a multiline string on round-trip: a value beginning with a newline is now rendered with an extra leading newline (the one the parser trims after the opening delimiter) so it survives re-parsing.
- Fix invalid serialization with a duplicated comma when removing a non-edge element from a parsed inline table. ([#486](https://github.com/python-poetry/tomlkit/pull/486))
- Fix invalid serialization with a duplicated comma when appending or inserting into a comma-first formatted array. ([#499](https://github.com/python-poetry/tomlkit/pull/499))
- Fix `ParseError` when a sub-table extends the last element of an array of tables after an unrelated table. ([#261](https://github.com/python-poetry/tomlkit/issues/261))
- Fix unparseable serialization when adding a key to a dotted-key table inside an inline table. ([#500](https://github.com/python-poetry/tomlkit/pull/500))
- Fix a table replaced by a plain value being serialized inside the preceding table's body when other tables follow; the value now moves before the first table like other root-level values. ([#504](https://github.com/python-poetry/tomlkit/issues/504))
- Fix assigning a table over a dotted key (e.g. `doc["a"] = {...}` where `a` came from `a.b = ...`): the dotted prefix was duplicated onto the new `[a]` header, and the header then swallowed any sibling that follows it on round-trip. The replacement now renders as a plain table and, when needed, moves before the inline entries (values and dotted keys) it would otherwise capture. ([#513](https://github.com/python-poetry/tomlkit/issues/513), [#524](https://github.com/python-poetry/tomlkit/issues/524))
- Restore `dumps()` rendering mapping-like wrappers around a parsed document (e.g. `dotty_dict`'s `Dotty`) through their delegated `as_string`, preserving the original table order and layout instead of re-encoding through a plain dict — a 0.15.0 regression. ([#482](https://github.com/python-poetry/tomlkit/issues/482))
- Fix uncontrolled recursion when parsing deeply nested documents: crafted input could crash the process with a `RecursionError`. Values nested more than 100 levels deep and keys with more than 100 dotted fragments now raise `ParseError`. ([#459](https://github.com/python-poetry/tomlkit/issues/459))
- Fix `comment()` producing invalid TOML for a multiline string by prefixing every line with `#`, not just the first. ([#449](https://github.com/python-poetry/tomlkit/issues/449))
- Fix the separator comma being swallowed by a trailing comment when appending a key to a multiline inline table, leaving the new key without a separator so the result no longer round-trips. ([#512](https://github.com/python-poetry/tomlkit/issues/512))
- Fix a `KeyAlreadyPresent` error when parsing or accessing an out-of-order table whose array-of-tables elements are split across the table's parts. ([#505](https://github.com/python-poetry/tomlkit/issues/505))
- Out-of-order value-vs-table and dotted-key-vs-table redefinitions are now rejected at parse time instead of being silently accepted or raising only on access. The parser also detects when a non-dotted key is a prefix of an existing dotted key, matching the stdlib `tomllib` behaviour. ([#523](https://github.com/python-poetry/tomlkit/issues/523))
- Reject tables inserted into inline tables instead of serializing invalid TOML. ([#531](https://github.com/python-poetry/tomlkit/issues/531))
- Fix assigning an array of tables over a dotted key (e.g. `doc["a"] = aot(...)` where `a` came from `a.b = ...`): the new `[[a]]` header kept the dotted key's inline position and swallowed the following dotted sibling on round-trip. The array of tables now renders past the inline entries it would otherwise capture, mirroring the table fix for [#513](https://github.com/python-poetry/tomlkit/issues/513). ([#542](https://github.com/python-poetry/tomlkit/issues/542))
- Fix a new top-level scalar being captured by a table rendered from a dotted key: appending a scalar after a dotted-key entry (e.g. `a.b = 1`) whose table had gained a `[a.c]`-style child placed the scalar inside that table's scope, silently re-nesting it on round-trip. Scalars now move before such an entry, like they do before regular tables. ([#543](https://github.com/python-poetry/tomlkit/issues/543))
- Fix invalid serialization with a duplicated `[table]` header when adding a key to an out-of-order table whose concrete header is declared after its sub-tables; the new key now lands in the existing concrete part instead of giving the header-less super part a second header. ([#545](https://github.com/python-poetry/tomlkit/pull/545))
- Fix a table's display name (its exact header spelling, including whitespace and quoting) being normalised when the table is assigned onto itself, e.g. `doc[k] = doc[k]` rewriting `[keys .'a'.'c']` to `[keys.a.'c']`. ([#291](https://github.com/python-poetry/tomlkit/issues/291))
- Fix missing newlines when appending a key after a dotted inline table, including when the original document has no trailing newline. ([#533](https://github.com/python-poetry/tomlkit/pull/533))
- Preserve trailing whitespace when replacing a super table, including assigning it onto itself. ([#534](https://github.com/python-poetry/tomlkit/pull/534))
- Fix `str()` and `repr()` of out-of-order table proxies to show their merged values. ([#536](https://github.com/python-poetry/tomlkit/pull/536))
- Reject decimal integer literals that exceed Python's integer-string conversion limit instead of coercing them to infinity. ([#538](https://github.com/python-poetry/tomlkit/pull/538))
py-tomlkit: updated to 0.15.0 0.15.0 Changed - Update parser to support TOML spec v1.1.0.
py-tomlkit: updated to 0.14.0 0.14.0 - 2026-01-13 Changed - Drop support for Python older than 3.9. Remove 3.8 from the CI matrix. Added - Custom encoders can now receive `_parent` and `_sort_keys` parameters to enable proper encoding of nested structures. - Add `String.type` property to get the string type. Fixed - Fixed `tomlkit.boolean()` API to correctly handle boolean inputs.
py-tomlkit: fix PLIST with latest poetry-core and depend on it
py-tomlkit: updated to 0.13.3 0.13.3 Added - Add `.item()` method to array and tables to retrieve an item by key. Fixed - Fix missing newline when parsing a separated array of tables without trailing new line. - Fix non-existing key error when deleting an item from an out-of-order table. - Ensure newline is added between the plain values and the first table. - Fix repeated whitespace when removing an array item. - Fix invalid serialization after removing array item if the comma is on its own line. - Fix serialization of a nested dotted key table. - Refine the error message when use non-string as single key. - Fix invalid serialization after overwriting a key of a out-of-order table.
py-tomlkit: updated to 0.13.2 0.13.2 Fixed - Fix deleting keys from an out-of-order table does not remove all table parts.
py-tomlkit: updated to 0.13.1 0.13.1 Fixed - Fix the `Table.is_super_table()` check for tables with dotted key as the only child. - Count table as a super table if it has children and all children are either tables or arrays of tables.
py-tomlkit: updated to 0.13.0 0.13.0 Changed - Expect a tomlkit-specific error instead of `TypeError` from a custom encoder. - Drop support for Python older than 3.8. Remove 3.7 from the CI matrix. Fixed - Fix the incompatiblity with 3.13 because of the `datetime.replace()` change. - Revert the change of parsing out-of-order tables. - Keep the nested out-of-order table.
py-tomlkit: updated to 0.12.5 0.12.5 [pre-commit.ci] pre-commit autoupdate chore(deps-dev): bump idna from 3.4 to 3.7 fix: CI workflow for macos chore(deps-dev): bump jinja2 from 3.1.3 to 3.1.4 fix: don't add sign if the float is negative fix: Construction of OutOfOrderTableProxy can cause newlines to be inserted
py-tomlkit: updated to 0.12.4 0.12.4 Fixed - Support `|` and `|=` operator for tables, and support `+` and `+=` operator for arrays. - Fix an index error when setting dotted keys in a table.
py-tomlkit: updated to 0.12.3 0.12.3 Fixed - Improve the performance when parsing a table with nested dotted keys. - Keep the newlines when replacing a table.
py-tomlkit: updated to 0.12.2 0.12.2 Fixed - Fixed a bug that overwriting a sub table with a plain value raises an error. - Correct the return type of integer division.
python/wheel.mk: simplify a lot, and switch to 'installer' for installation This follows the recommended bootstrap method (flit_core, build, installer). However, installer installs different files than pip, so update PLISTs for all packages using wheel.mk and bump their PKGREVISIONs.
py-tomlkit: updated to 0.12.1 0.12.1 Fixed - Make float and int hashable. 0.12.0 Added - Allow users to specify encoders for custom types. Fixed - Fix the incorrect sort when building a table with dotted keys. - Complete the methods required for integer and float items. - Replace the deprecated usage of `datetime.utcnow()`. - Minor performance improvements when iterating over the escape sequences.
py-tomlkit: updated to 0.11.8 0.11.8 Fixed - Remove the extra indentations added when parsing nested sub-tables. - Ignore the CRLF immediately following a multiple basic string opening. - Stringifying subtables and nested tables in arrays of tables. - Messed table structure when building a table with dotted keys.
py-tomlkit: updated to 0.11.7 0.11.7 Fixed - Parse empty table name if it is quoted. - Fix a bug that remove last element of an Inline Table leaves a comma. - Parse datetime when it is followed by a space. - Fix the `unwrap()` method for `Container` children values which sometimes returns an internal object if the table is an out-of-order table. - Fix the wrong return type when doing arithmetic operations between integers and floats.
py-tomlkit: updated to 0.11.6 0.11.6 Fixed - Allow broader type for toml file path value - Auto-determine if a table is a super table if not specified explicitly.
py-tomlkit: updated to 0.11.5 0.11.5 Fixed - Fix the type annotation of `unwrap()` and datetime parsing. - Clear the existing table header when it is adding to another table. - Fix a bug that escape chars are lost after concat with another string. - Fix a rendering issue of tables inside arrays or inline tables.
py-tomlkit: update to 0.11.4. ## [0.11.4] - 2022-08-12 ### Fixed - Fix a memory leak caused by `lru_cache` on methods. ([#227](https://github.com/sdispater/tomlkit/issues/227))
py-tomlkit: updated to 0.11.3 0.11.3 Fixed - Fix a regression issue that copying an array results in extra `None` items. - Fix a regression of `array.add_line` that it incorrectly adds a comma to non-value lines.
py-tomlkit: updated to 0.11.2 0.11.2 Fixed - Fix adding float to an integer value. - Keep the end-of-array style when adding items to or removing items from an array. - Fix a bug of redundant table header shown when removing children from a super table.
py-tomlkit: updated to 0.11.1 0.11.1 Changed - Keep consistent line endings when changing files. - Make `KeyAlreadyPresent` and `InvalidStringError` subclasses of `ParseError`. - Remove empty table from `OutOfOrderTableProxy` when deleting items. - Raise errors when trying to access unsupported methods on `OutOfOrderTableProxy`. Fixed - Fix `unwrap()` for String values to remove the quotes.
py-tomlkit: updated to 0.11.0 0.11.0 Added - Add `unwrap` methods that return tomlkit objects recursively converted to plain python objects.
py-tomlkit: updated to 0.10.2 0.10.2 Fixed - Use the plain python string representation of `Key` in `KeyAlreadyPresent` error message. - Fix the `astimezone()` and `replace()` methods of datetime objects. - Add type definitions for `items()` function.
py-tomlkit: updated to 0.10.1 0.10.1 Fixed - Preserve the newlines before super tables when rendering. - Fix the bug that comments are appended with comma when rendering a multiline array. 0.10.0 Fixed - Fix the only child detection when creating tables. - Include the `docs/` directory and `CHANGELOG.md` in sdist tarball.
py-tomlkit: updated to 0.9.1 0.9.1 Fixed Fix a bug of separators not being kept when replacing the value. Tuples should be dumped as TOML arrays.
py-tomlkit: updated to 0.9.0 0.9.0 Added Add a new argument to table API to allow it to be a super table. Support adding item to Table and Container with dotted key. Fixed Fix a bug of value() API that parses string incompletely.
py-tomlkit: added version 0.8.0 TOML Kit is a 1.0.0-compliant TOML library. It includes a parser that preserves all comments, indentations, whitespace and internal element ordering, and makes them accessible and editable via an intuitive API. You can also create new TOML documents from scratch using the provided helpers.