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
- id: C1 claim: tomllib parses TOML and does not write it. source: S1 evidence: "This module does not support writing TOML."
- id: C2 claim: The module was added in 3.11 for TOML 1.0.0. source: S1 evidence: "The module was added with support for TOML 1.0.0."
- id: C3 claim: Current docs describe an interface for parsing TOML 1.1.0. source: S1 evidence: "This module provides an interface for parsing TOML 1.1.0"
- id: C4 claim: PEP 680 proposed adding tomllib to the standard library. source: S2 evidence: "This PEP proposes adding the `
tomllib` module to the standard library for"
Sources
- [S1] tomllib — Parse TOML files. Python docs. https://docs.python.org/3/library/tomllib.html . License: PSF-2.0. Accessed 2026-11-16.
- [S2] PEP 680 – tomllib: Support for Parsing TOML in the Standard Library. Python PEPs. https://peps.python.org/pep-0680/ . License: Public domain or CC0-1.0. Accessed 2026-11-16.
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
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.},
}
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.