tomli

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

Library
PyPI
v2.4.1
571stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
49/100Fair
Development Activity44
Maintenance0
Community64
Maturity60
Momentum28

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
82/100Excellent
Architecture82
Code Quality90
Innovation65
Learning Curve90

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
100%
Apache 2.0

Agno

Devops · AI Development · Automation

41,969

Build, run, and manage agent platforms with a full production stack — SDK, runtime, and control plane included.

View details
93
Repo Health
87
Technical
66
Dependency
Built with
Python100%
Updated today
Python
90%
Apache 2.0

Apache Airflow

Data Engineering

46,645

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.

View details
96
Repo Health
89
Technical
65
Dependency
Built with
Python90%
Updated today
Python
59%
Apache 2.0

argilla

AI Development · Data Engineering

5,088

Collaborate on high-quality AI training data with a self-hosted annotation platform built for LLMs, NLP, and multimodal models.

View details
65
Repo Health
81
Technical
61
Dependency
Built with
Python59%
Jupyter Notebook21%
Updated 6 days ago
TypeScript
49%
AGPL 3.0

Banana Slides

AI Design Tools · Productivity

15,520

AI-native PPT generator with Vibe editing, multi-LLM support, and fully editable PPTX export

View details
84
Repo Health
82
Technical
71
Dependency
Built with
TypeScript49%
Python46%
Updated today
C++
69%
Apache 2.0

ClickHouse

Databases · Analytics · Data Engineering

49,535

Open-source column-oriented database that delivers real-time analytical queries on petabyte-scale data with millisecond latency.

View details
95
Repo Health
90
Technical
68
Dependency
Built with
C++69%
Python13%
Updated today
Python
82%
Apache 2.0

codeindex

Developer Tools

271

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.

View details
58
Repo Health
73
Technical
0
Dependency
Built with
Python82%
HTML18%
Updated 2 months ago
Rust
95%
Other

Databend

Databases · Data Engineering

9,426

Open-source enterprise data warehouse unifying analytics, vector search, full-text search, and AI agent orchestration in a single Rust-built engine on S3.

View details
91
Repo Health
84
Technical
78
Dependency
Built with
Rust95%
Updated today
C++
74%
Other

Dragonfly

Databases · Developer Tools · Devops

31,051

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.

View details
90
Repo Health
9
Technical
70
Dependency
Built with
C++74%
Python16%
Updated today
Python
81%
Apache 2.0

headroom

AI Development · Developer Tools

68,054

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.

View details
84
Repo Health
86
Technical
72
Dependency
Built with
Python81%
Rust13%
Updated today

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

Search