tomli
A lil' TOML parser for Python — fast, spec-compliant, and dependency-free.
Repository Health
Technical Analysis
Tomli is a minimal Python library for parsing TOML documents into plain Python dictionaries. It began as the reference implementation that was eventually merged into the Python 3.11 standard library as tomllib, and it continues to ship on PyPI as a backport for the many projects still targeting older Python versions, plus anyone on 3.11+ who wants its faster mypyc-compiled wheels.
The library has no runtime dependencies, targets full compliance with the TOML specification (verified against the toml-lang/toml-test conformance suite), and deliberately does no more than parsing — there is no comment-preserving round-trip editor and no dumps/write function (that lives in the companion project Tomli-W). This narrow scope keeps the codebase small, auditable, and easy to reason about, which is exactly what a library sitting underneath pip, Poetry, and countless build backends needs to be.
What You Get
loads()andload()functions that parse a TOML string or an open binary file object into a plain dict- A dedicated
TOMLDecodeErrorexception with informational messages for invalid documents - Mypyc-compiled binary wheels on major platforms for near-native parsing speed, with a pure-Python fallback everywhere else
- A
parse_floathook to swap indecimal.Decimalor another callable wherever the spec would otherwise produce a Pythonfloat - Zero runtime dependencies and full type annotations (py.typed) for a clean drop into any project’s dependency tree
Common Use Cases
- Reading
pyproject.tomlinside build backends, linters, and other Python tooling - Providing a
tomllibpolyfill so a single codebase supports Python 3.6+ while still using the standard library module on 3.11+ - Loading TOML-based application or CLI configuration files at startup
- Parsing TOML data files in scripts and pipelines where JSON/YAML aren’t the source format
- Validating TOML documents against the spec during CI or pre-commit checks
Under The Hood
Architecture
Tomli is a small, flat package (src/tomli/) built around a single hand-written recursive-descent parser in _parser.py (roughly 800 lines) that walks the input string character by character rather than relying on a parser-generator or tokenizer/AST split. _re.py holds the small set of regular expressions used for datetime, local-time, and number literals, lazily imported (__lazy_modules__) so that importing tomli stays cheap when those code paths aren’t hit. _types.py defines the handful of internal type aliases (Key, ParseFloat, Pos) used for static typing, and __init__.py re-exports just three names — loads, load, TOMLDecodeError — as the entire public surface. Inline tables and arrays are parsed via recursion, with an explicit nesting cap tied to sys.getrecursionlimit() to avoid crashing the mypyc-compiled binary wheels on pathologically nested documents, a deliberate defensive measure called out directly in the source comments.
Tech Stack
The library targets Python 3.8+ with from __future__ import annotations for forward-compatible type hints, and has zero runtime dependencies. It’s built with flit_core as the PEP 517 build backend and versioned via bump2version. The standout tooling choice is mypyc, which compiles the same Python source into binary wheels for CPython on the major platforms, giving Tomli C-extension-like parsing speed while keeping a single pure-Python source tree; PyPy and platforms without prebuilt wheels transparently fall back to the interpreted path. Tooling around the core includes tox for running the test matrix across Python 3.8 through 3.14 (plus PyPy), pre-commit for linting, and a fuzzer/ directory wired up for coverage-guided fuzz testing.
Code Quality
Tests live under tests/ and run via the standard-library unittest module, with tests/burntsushi.py wiring in the external toml-lang/toml-test conformance suite against tests/data/valid and tests/data/invalid fixtures — this is how the project verifies full TOML spec compliance rather than relying only on hand-written cases. mypy --strict (with strict_bytes and warn_unreachable enabled) is configured across the source tree, and .flake8 plus a .pre-commit-config.yaml enforce style. CI runs the test matrix across Python 3.8–3.14, PyPy, and Linux/macOS/Windows, and a separate linters job blocks the release workflow from firing if pre-commit fails. The project reports 100% branch coverage via coverage.py configuration in pyproject.toml.
What Makes It Unique
Tomli’s defining trait is being small on purpose: it was written specifically to become the model for Python’s own tomllib, so its scope stops exactly at parsing — no serialization, no comment-preserving edits, no configuration framework wrapped around it. Its combination of a pure-Python implementation with mypyc-compiled binary wheels is a comparatively rare pattern that gives it near-native performance without forcing a C toolchain on downstream users, and its benchmark suite in benchmark/ documents that speed advantage directly against toml, tomlkit, and other pure-Python competitors.
Used by 19 apps in this directory
Agno
Devops · AI Development · Automation
Build, run, and manage agent platforms with a full production stack — SDK, runtime, and control plane included.
Apache Airflow
Data Engineering
Define, schedule, and monitor complex data workflows as Python code — with a powerful UI, 80+ provider integrations, and battle-tested scalability across thousands of production deployments.
argilla
AI Development · Data Engineering
Collaborate on high-quality AI training data with a self-hosted annotation platform built for LLMs, NLP, and multimodal models.
Banana Slides
AI Design Tools · Productivity
AI-native PPT generator with Vibe editing, multi-LLM support, and fully editable PPTX export
ClickHouse
Databases · Analytics · Data Engineering
Open-source column-oriented database that delivers real-time analytical queries on petabyte-scale data with millisecond latency.
codeindex
Developer Tools
A temporal code knowledge graph with blast-radius impact scoring, semantic symbol search, and git-history-aware dependency analysis for AI-assisted development — zero required runtime dependencies, SQLite-backed.
Databend
Databases · Data Engineering
Open-source enterprise data warehouse unifying analytics, vector search, full-text search, and AI agent orchestration in a single Rust-built engine on S3.
Dragonfly
Databases · Developer Tools · Devops
A modern Redis and Memcached replacement engineered for multi-core servers — delivering 25x more throughput, better cache hit rates, and up to 80% lower memory consumption with full API compatibility.
headroom
AI Development · Developer Tools
Compress everything your AI agent reads — tool outputs, logs, RAG chunks, and files — before it reaches the LLM, achieving 60–95% fewer tokens with the same answers.