Small, fast TOML 1.1.0 parser for Python
open sourceMITfree
Tomli is a small Python library that parses TOML into plain dicts of built-in types. Version 2.4.0 and later follow TOML v1.1.0. A version of it became the standard library's tomllib in Python 3.11 (PEP 680), and Tomli carries a TOML v1.1.0 backport for Python versions older than 3.15. It only reads TOML; its companion Tomli-W writes it.
Problems it solves
- read a pyproject.toml or other TOML config file in Python
- parse TOML on Python versions older than 3.11, which lack tomllib
- load TOML floats as exact decimals in Python
Features
- parses TOML v1.1.0 (v2.4.0 and later) into a plain dict
- loads and load for strings and binary files
- parse_float hook, for example to build decimal.Decimal values
- TOML v1.1.0 backport of the standard library's tomllib for Python before 3.15
- optional mypyc-compiled wheel for speed
Limitations
Alternatives
The same job
These do what Tomli does.
- TOML Kit Style-preserving TOML library for Python that keeps comments and layout
