tomlrt
A format-preserving TOML reader and writer for Python.
Decision gist · record as of 2026-08-14
Yes. tomlrt solves a real problem—standard TOML parsers discard formatting, making them unsuitable for editing user-facing config files. The package is actively maintained, has no known vulnerabilities, carries a permissive MIT license, and installs with minimal friction. Use it whenever you need to read, modify, and write TOML while respecting the original document's structure.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.10 or later.
- Low friction: pure Python wheel, single lightweight dependency (typing-extensions), active maintenance with a release 1 day old.
License · maintenance · safety
MIT (permissive) — MIT license permits unrestricted use, modification, and distribution in both open-source and commercial projects.
last release 2026-08-13 (1 days) · last repo commit 2026-08-14 · 7 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 93,055 downloads/mo, #13,403 on PyPI
Alternatives
Verify before relying
import tomlrt
with open("pyproject.toml", "rb") as f:
doc = tomlrt.load(f)
doc["project"]["version"] = "0.2.0"
print(tomlrt.dumps(doc))- Whether round-trip fidelity holds for all TOML 1.1 edge cases (inline tables, nested structures, escape sequences).
- Performance characteristics on large configuration files (parsing speed, memory usage).
- Behavior when modifying deeply nested structures or adding new keys not in the original document.
What it is and what it does
tomlrt is a TOML parser and writer that treats formatting as data rather than noise. When you load a TOML file, edit it, and dump it back, every byte you didn't touch stays exactly as it was—comments, blank lines, indentation, quote style, and number formatting all round-trip intact. This makes it ideal for tools that need to modify configuration files programmatically while preserving human-written structure and intent.
The package supports TOML 1.1 and exposes both a file-based API (load/dump) and a programmatic one (Document class for building documents from scratch). It depends only on typing-extensions, keeping the install lightweight. The implementation is pure Python, distributed as a wheel, and requires Python 3.10 or later.
Use it for
- Updating version strings or dependencies in pyproject.toml while keeping existing comments and formatting intact.
- Building configuration management tools that edit TOML files without destroying developer-written structure.
- Programmatically modifying application config files where preserving layout matters for readability or version control diffs.
- Creating TOML editors or linters that need to round-trip documents without lossy parsing.
- Generating new TOML documents from scratch using the Document API when format preservation isn't required.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
tomlrt solves a real problem—standard TOML parsers discard formatting, making them unsuitable for editing user-facing config files. The package is actively maintained, has no known vulnerabilities, carries a permissive MIT license, and installs with minimal friction. Use it whenever you need to read, modify, and write TOML while respecting the original document's structure.
Install
tomlrt on PyPI
Before you install
Low friction: pure Python wheel, single lightweight dependency (typing-extensions), active maintenance with a release 1 day old.
Requires Python 3.10 or later.
License in practice
MIT license permits unrestricted use, modification, and distribution in both open-source and commercial projects.
Quickstart
import tomlrt
with open("pyproject.toml", "rb") as f:
doc = tomlrt.load(f)
doc["project"]["version"] = "0.2.0"
print(tomlrt.dumps(doc))
Verify before relying
- Whether round-trip fidelity holds for all TOML 1.1 edge cases (inline tables, nested structures, escape sequences).
- Performance characteristics on large configuration files (parsing speed, memory usage).
- Behavior when modifying deeply nested structures or adding new keys not in the original document.
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.10 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 1 packagetyping-extensions |
| Maintenance | Actively maintained 1 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 93,055 / month, #13,403 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Intended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3Typing :: Typed |
Evidence: tomlrt-2.2.2-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 parser preserves formatting”
- tomlrtReads and writes TOML files while preserving formatting, comments,…
- tomlkitParses and edits TOML files while preserving formatting, comments,…
- pyproject-fmtFormats pyproject.toml files with consistent, opinionated style and…
Give your agent the search over MCP, or paste the wish link into any chat.
More Markup packages
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.
A Python markdown parser that converts markdown to HTML following the CommonMark specification, with support for plugins and custom syntax rules.
Install it if you need reliable markdown-to-HTML conversion.
Beautiful Soup parses HTML and XML documents into a navigable tree, providing Pythonic methods to search, iterate, and modify the parsed content.
Install it if you need to parse or extract data from markup documents.
et_xmlfile writes large XML files with minimal memory overhead by serializing elements to disk as they are created, rather than holding the entire tree in memory.
Install it if incremental XML writing fits your use case; skip it if your XML documents are small or you already use lxml.
Parses and edits TOML files while preserving formatting, comments, and structure, then serializes them back with layout intact.
Install it if you're building tools that touch TOML files and user readability of the source matters.
Parses Python docstrings in ReST, Google, Numpydoc, and Epydoc formats, extracting structured information like descriptions, parameters, return types, and exceptions.
Install it if you need to programmatically read and extract structured data from Python docstrings.
See also tomli-w · pytoml · edn-format · pyproject-fmt · toml-cli · tox-toml-fmt · toml-sort · gguf · tomli