- Added
- Always preserve
decimal.Decimaltype in parse round trips
- Always preserve
- Improved
- Better
TypeErrormessage on invalid mapping keys - Unify type representation in error messages
- Better
- Performance
- Improve import time by removing
typingimport - Improve import time by removing
stringimport - Improve import time by lazy importing
decimal
- Improve import time by removing
- Removed
- Support for Python 3.7 and 3.8
- Added
- Accept generic
collections.abc.Mapping, not justdict, as input. Thank you Watal M. Iwasaki for the PR. indentkeyword argument for customizing indent width of arrays. Thank you Wim Jeantine-Glenn for the PR.
- Accept generic
- Type annotations
- Type annotate
dumpfunction's output stream object astyping.IO[bytes](previouslytyping.BinaryIO)
- Type annotate
- Removed
- Support for Python 3.6
- Positional arguments of
dumpanddumpscan no longer be passed by keyword.
- Changed
- Revised logic for when the "Array of Tables" syntax will be used. AoT syntax is used when at least one of the tables needs multiple lines, or a single line wider than 100 chars, when rendered inline. A nested structure no longer alone triggers the AoT syntax.
- Added
- Support for formatting Python
tuples as TOML arrays.
- Support for formatting Python
- Fixed
- Formatting of
decimal.Decimal("inf"),decimal.Decimal("-inf")anddecimal.Decimal("nan").
- Formatting of
- Changed
- A list of dicts is now rendered using the "Array of Tables" syntax if at least one of the tables is a nested structure, or at least one of the tables would need a line wider than 100 chars when rendered inline. Thank you Anderson Bravalheri for the PR.
- Changed
dumpnow supports binary file objects instead of text file objects
- Added
multiline_stringskeyword argument for enabling multi-line strings
- Changed
- Style: Do not make multi-line strings by default because they don't support lossless round-tripping
- Changed
- Style: Decide between multi-line and single line string solely based on if line breaks are present
- Added
tomli_w.dump
- Changed
- Style: Format strings containing line breaks and that are longer than threshold value as multiline strings
- Added
tomli_w.dumps