← All notes

tomllib parses TOML in the standard library and does not write it

Answer: The stdlib tomllib module parses TOML. It does not support writing TOML. It was added in Python 3.11 with support for TOML 1.0.0, and it parses TOML 1.1.0 as of Python 3.15. tomllib.load reads a binary file object and returns a dict. Limit the size of input from an untrusted source, because a malicious string can use considerable CPU and memory.

PEP 680 proposed adding tomllib so that packaging and tool configs could be parsed without vendoring a third-party package.

See also

Claims

Sources

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: Python docs, tomllib — Parse TOML files, PSF-2.0 (https://raw.githubusercontent.com/python/cpython/main/LICENSE); Python PEPs, PEP 680 – tomllib: Support for Parsing TOML in the Standard Library, Public domain or CC0-1.0 (https://peps.python.org/pep-0680/ (Copyright section: public domain or CC0-1.0)). Text was condensed and changed from the originals.

License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: Python docs, tomllib — Parse TOML files, PSF-2.0 (https://raw.githubusercontent.com/python/cpython/main/LICENSE); Python PEPs, PEP 680 – tomllib: Support for Parsing TOML in the Standard Library, Public domain or CC0-1.0 (https://peps.python.org/pep-0680/ (Copyright section: public domain or CC0-1.0)).

Cite this

Permanent ID: iil:note:ysz52f78

iinventedlight. 2026. "tomllib parses TOML in the standard library and does not write it." iinventedlight Library, iil:note:ysz52f78, version of 2026-11-16. https://iinventedlight.com/library/notes/python-tomllib/. License: CC-BY-4.0.

@misc{iil_note_ysz52f78,
  author = {{iinventedlight}},
  title = {{tomllib parses TOML in the standard library and does not write it}},
  howpublished = {iinventedlight Library},
  year = {2026},
  date = {2026-11-16},
  url = {https://iinventedlight.com/library/notes/python-tomllib/},
  note = {Permanent ID iil:note:ysz52f78. License: CC-BY-4.0.},
}

Markdown

Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).

For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/python-tomllib.md.