tomli
A lil' TOML parser
Decision gist · record as of 2026-08-14
Yes. Tomli is a well-maintained, zero-dependency parser with no known vulnerabilities, permissive MIT licensing, and active development. Install it if you need to read TOML on Python versions before 3.11, or if you want mypyc-compiled performance on any version. The low install friction and broad platform support make it a straightforward choice for TOML parsing.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- TOML files must be opened in binary mode ("rb") to ensure correct UTF-8 decoding and newline handling.
- Low friction: pure Python with no runtime dependencies, distributed as a wheel.
- Active maintenance with recent releases.
License · maintenance · safety
MIT (permissive) — MIT license permits unrestricted use, modification, and distribution in both open-source and proprietary projects with minimal obligations.
last release 2026-03-25 (142 days) · last repo commit 2026-08-10 · 570 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 398,040,232 downloads/mo, #108 on PyPI
Alternatives
Verify before relying
pip install tomli
import tomli
with open("config.toml", "rb") as f:
config = tomli.load(f)
# or parse a string
data = tomli.loads("key = 'value'")- Whether mypyc-compiled wheels provide measurable performance gains in typical application workloads compared to pure Python
- Compatibility guarantees or timeline for TOML v1.1.0 features across different Python versions
What it is and what it does
Tomli is a minimal, dependency-free TOML parser for Python that converts TOML configuration files and strings into native Python dictionaries. It reads TOML v1.1.0 format (or v1.0.0 in older versions) and maps TOML types directly to Python builtins and standard library types—strings, integers, floats, booleans, dates, times, and nested structures. The library was incorporated into Python's standard library as tomllib in version 3.11, but Tomli continues as a backport for earlier Python versions and offers optional mypyc-compiled wheels for improved performance on common platforms.
The package is designed for read-only TOML parsing; it does not support writing TOML or preserving comments during round-trip parsing. It handles parse errors by raising tomli.TOMLDecodeError and allows custom float handling via a parse_float parameter, useful for cases where decimal precision matters. With zero runtime dependencies, low install friction, and active maintenance, it serves as a lightweight solution for applications that need to read TOML configuration files on Python 3.8 and later.
Use it for
- Read application configuration from TOML files in projects targeting Python versions before 3.11
- Parse TOML strings in build tools or configuration management scripts that need structured data
- Handle TOML floats with decimal precision using parse_float=Decimal for financial or scientific calculations
- Build compatibility layers that use tomllib on Python 3.11+ and fall back to tomli on earlier versions
- Process pyproject.toml or other TOML-based configuration in package management workflows
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
Tomli is a well-maintained, zero-dependency parser with no known vulnerabilities, permissive MIT licensing, and active development. Install it if you need to read TOML on Python versions before 3.11, or if you want mypyc-compiled performance on any version. The low install friction and broad platform support make it a straightforward choice for TOML parsing.
Install
tomli on PyPI
Before you install
Low friction: pure Python with no runtime dependencies, distributed as a wheel. Active maintenance with recent releases. Mypyc-compiled wheels available for performance on most platforms; pure Python fallback works everywhere.
TOML files must be opened in binary mode ("rb") to ensure correct UTF-8 decoding and newline handling.
License in practice
MIT license permits unrestricted use, modification, and distribution in both open-source and proprietary projects with minimal obligations.
Quickstart
pip install tomli
import tomli
with open("config.toml", "rb") as f:
config = tomli.load(f)
# or parse a string
data = tomli.loads("key = 'value'")
Verify before relying
- Whether mypyc-compiled wheels provide measurable performance gains in typical application workloads compared to pure Python
- Compatibility guarantees or timeline for TOML v1.1.0 features across different Python versions
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.8 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | None |
| Maintenance | Actively maintained 142 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 398,040,232 / month, #108 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Operating System :: MacOSOperating System :: Microsoft :: WindowsOperating System :: POSIX :: LinuxProgramming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: Software Development :: Libraries :: Python ModulesTyping :: Typed |
Evidence: tomli-2.4.1-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “toml string parsing”
- tomliTomli parses TOML configuration files and strings into Python…
- rtomlrtoml parses and serializes TOML files and strings to and from Python…
- tree-sitter-tomlProvides a tree-sitter parser grammar for TOML files, enabling…
Give your agent the search over MCP, or paste the wish link into any chat.
More Python Modules packages
Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.
Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.
Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.
PyYAML parses and emits YAML 1.1 data format, enabling serialization and deserialization of configuration files and Python objects to and from human-readable YAML text.
Pydantic validates Python data structures against type hints, coercing and checking input at runtime to ensure it matches a declared schema.
Provides reusable metadata objects for use with PEP-593 `typing.Annotated` to express common constraints like bounds, collection sizes, and predicates on types.
Install it if you use or build libraries that need to express type constraints in a standardized, inspectable way—or if you want to annotate your own types with…
Provides runtime tools to inspect and introspect Python type annotations, enabling programmatic examination of type hints at execution time.
See also tomli-w · tomlkit · toml-rs · rtoml · pytoml · parse-errors · dom-toml · tomlrt · toml-sort · taplo