toml-rs
A High-Performance TOML Parser for Python written in Rust
What it is and what it does
toml-rs is a TOML parser and serializer implemented in Rust and exposed to Python, designed as a faster alternative to the standard library's tomllib. It parses TOML v1.0.0 and v1.1.0 into Python dictionaries and can serialize Python dictionaries back to TOML format. The package aims for drop-in compatibility with tomllib for most use cases, though it adds features like serialization (dumps/dump methods) and provides more detailed error messages that pinpoint parse failures with context.
The package has no runtime dependencies beyond Python itself, making installation straightforward on supported platforms. It supports Python 3.10 through 3.15 and runs on CPython and PyPy. The Rust implementation is the core differentiator—it trades the simplicity of a pure-Python parser for speed, which matters most when parsing large TOML files or in performance-sensitive applications.
Use it for:
- Replace tomllib in projects requiring faster TOML parsing or better error diagnostics
- Serialize Python configuration objects back to TOML files for config management workflows
- Parse TOML configuration files in CLI tools or build systems where performance is measurable
- Handle TOML v1.1.0 features in applications that need newer TOML spec support
- Migrate from other TOML libraries while maintaining mostly compatible code
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
A high-performance TOML parser and serializer for Python, written in Rust, with drop-in compatibility for most tomllib use cases and support for TOML v1.0.0 and v1.1.0.
Yes, if you need TOML parsing and either want faster performance than tomllib or need serialization support. The package is actively maintained, has no dependencies, and carries permissive licensing. Install friction is moderate due to compilation, but prebuilt wheels cover common platforms. No known vulnerabilities. Not necessary if tomllib's speed and read-only API suit your use case.
Install
toml-rs on PyPI
pip
pip install toml-rsuv
uv add toml-rspoetry
poetry add toml-rsInstalling toml-rs
Before you install
Medium install friction due to compiled wheels; prebuilt binaries available for common platforms (macOS, Linux, Windows across multiple architectures). Actively maintained with recent releases; repository shows 32 stars and last commit on 2026-08-14.
License in practice
Licensed under Unlicense (permissive), placing the package in the public domain with no restrictions on use, modification, or distribution.
Quickstart
pip install toml-rs
import toml_rs
toml_string = 'title = "Example"\n[section]\nkey = "value"'
data = toml_rs.loads(toml_string)
output = toml_rs.dumps(data)
Requires Python 3.10 or later; precompiled wheels available for most platforms but installation may require compilation on unsupported architectures.
Verify before relying
- Actual performance comparison with tomllib and other TOML parsers (benchmarks referenced but not provided in fact sheet)
- Completeness of tomllib compatibility beyond the stated differences
- Support status for PyPy implementation (listed in classifiers but not detailed)
Package facts
| License | Unlicense (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | medium — platform-specific wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 38 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 104,598/month — #12,744 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: toml_rs-0.3.16-cp310-cp310-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl; toml_rs-0.3.16-cp310-cp310-macosx_10_12_x86_64.whl; toml_rs-0.3.16-cp310-cp310-macosx_11_0_arm64.whl; toml_rs-0.3.16-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl; toml_rs-0.3.16-cp310-cp310-manylinux_2_17_armv7l.manylinux2014_armv7l.whl; toml_rs-0.3.16-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl; toml_rs-0.3.16-cp310-cp310-manylinux_2_17_ppc64.manylinux2014_ppc64.whl; toml_rs-0.3.16-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl; toml_rs-0.3.16-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; toml_rs-0.3.16-cp310-cp310-manylinux_2_31_riscv64.whl; toml_rs-0.3.16-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.whl; toml_rs-0.3.16-cp310-cp310-musllinux_1_2_aarch64.whl; toml_rs-0.3.16-cp310-cp310-musllinux_1_2_armv7l.whl; toml_rs-0.3.16-cp310-cp310-musllinux_1_2_i686.whl; toml_rs-0.3.16-cp310-cp310-musllinux_1_2_ppc64le.whl; toml_rs-0.3.16-cp310-cp310-musllinux_1_2_riscv64.whl; toml_rs-0.3.16-cp310-cp310-musllinux_1_2_x86_64.whl; toml_rs-0.3.16-cp310-cp310-win32.whl; toml_rs-0.3.16-cp310-cp310-win_amd64.whl; toml_rs-0.3.16-cp310-cp310-win_arm64.whl
Keywords: TOML, TOML 1.0, TOML 1.1, TOML parser, TOML dumper
Tags
More Libraries packages
urllib3 is an HTTP client library that provides…
permissive · top 100 on PyPI
requestsRequests is a Python HTTP library that…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
python-dateutilProvides parsing, arithmetic, and recurrence…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
pytestpytest is a testing framework that lets you…
permissive · top 100 on PyPI
rtomlrtoml parses and serializes TOML files and…
permissive · top 5,000 on PyPI
yaml-rsA high-performance YAML v1.2 parser for Python,…
permissive · top 15,000 on PyPI
tomlParses and generates TOML configuration files,…
permissive · top 1,000 on PyPI
tomliTomli parses TOML configuration files and…
permissive · top 1,000 on PyPI
taploTaplo is a TOML v1.0.0 toolkit that provides…
permissive · top 15,000 on PyPI
chalkpy-rsProvides a native Rust extension package that…
unclear · top 15,000 on PyPI
toonstoons is a Rust-backed Python parser and…
unclear · top 5,000 on PyPI
tree-sitter-tomlProvides a tree-sitter parser grammar for TOML…
permissive · top 5,000 on PyPI
dom-tomlProvides utilities and helpers for working with…
permissive · top 5,000 on PyPI
toml-sortCommand-line utility and Python library to sort…
permissive · top 15,000 on PyPI