tomli

A lil' TOML parser for Python — fast, spec-compliant, and dependency-free.

Library
PyPI
v2.5.0
573 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
65 /100 Good
Development Activity 76
Maintenance 32
Community 64
Maturity 60
Momentum 28

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
82 /100 Excellent
Architecture 82
Code Quality 90
Innovation 65
Learning Curve 90

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() and load() functions that parse a TOML string or an open binary file object into a plain dict
  • A dedicated TOMLDecodeError exception 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_float hook to swap in decimal.Decimal or another callable wherever the spec would otherwise produce a Python float
  • Zero runtime dependencies and full type annotations (py.typed) for a clean drop into any project’s dependency tree

Common Use Cases

  • Reading pyproject.toml inside build backends, linters, and other Python tooling
  • Providing a tomllib polyfill 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

Python
69%
MIT

Langflow

AI Agents · AI Development

155,451

Build, test, and deploy AI agents and RAG workflows visually with native API and MCP server export.

View details
90
Repo Health
85
Technical
65
Dependency
Built with
Python 69%
TypeScript 22%
Updated 1 weeks ago
Python
95%
MIT

MemPalace

AI Agents · AI Development · AI Memory

59,486

Local-first AI memory with verbatim storage, pluggable backends, and 96.6% retrieval recall on LongMemEval — no API key required.

View details
86
Repo Health
84
Technical
73
Dependency
Built with
Python 95%
Updated 2 weeks ago
Python
59%
Apache 2.0

MLflow

AI Development · Monitoring

28,331

The open source AI engineering platform for debugging, evaluating, monitoring, and optimizing production LLMs and agents at scale.

View details
96
Repo Health
86
Technical
66
Dependency
Built with
Python 59%
TypeScript 33%
Updated 1 weeks ago
Python
65%
Other

Morphik

AI Development · Databases · Search

3,717

Morphik is an AI-native ingestion and retrieval engine that lets developers store, search, and reason over visually rich documents — scanned PDFs, manuals, slides, and video — without duct-taping together OCR, an embedding model, and a vector database.

View details
60
Repo Health
71
Technical
67
Dependency
Built with
Python 65%
TypeScript 23%
Updated 2 weeks ago
TypeScript
56%
MIT

open-notebook

AI Assistants · Note Taking

40,014

A privacy-first, self-hosted AI research notebook with 18+ model providers, multi-speaker podcast generation, and full REST API—your open-source alternative to Google Notebook LM.

View details
89
Repo Health
84
Technical
71
Dependency
Built with
TypeScript 56%
Python 42%
Updated 2 weeks ago
Python
38%
Apache 2.0

OpenSandbox

Developer Tools · Security

15,761

Secure, fast, and extensible sandbox runtime for AI agents with multi-language SDKs and Docker/Kubernetes runtimes.

View details
85
Repo Health
81
Technical
70
Dependency
Built with
Python 38%
Go 37%
Updated 1 weeks ago
Python
100%
MIT

Ossature

AI Development

202

An open-source build system that turns written specs and architecture into working code — an LLM generates code under tight constraints, task by task with narrow context windows, instead of attempting an entire codebase at once.

View details
45
Repo Health
70
Technical
75
Dependency
Built with
Python 100%
Updated 2 months ago
TypeScript
51%
Other

Phase Console

Devops · Security

929

End-to-end encrypted secrets management for engineering teams — from local dev to Kubernetes production.

View details
84
Repo Health
73
Technical
63
Dependency
Built with
TypeScript 51%
Python 48%
Updated 2 weeks ago
C
76%
AGPL 3.0

TDengine

Databases

25,151

A high-performance, open-source time-series database built in C for IoT, connected vehicles, and industrial monitoring workloads, with built-in stream processing, caching, and data subscription.

View details
97
Repo Health
71
Technical
68
Dependency
Built with
C 76%
C++ 16%
Updated 2 weeks ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers