tomlrt 2.3.2


pip install tomlrt

  Latest version

Released: Oct 23, 2026


Meta
Author: David Hotham
Requires Python: >=3.11

Classifiers

Intended Audience
  • Developers

Operating System
  • OS Independent

Programming Language
  • Python :: 3

Typing
  • Typed

tomlrt

PyPI Python versions License CI Docs

A format-preserving TOML reader and writer for Python.

Parse a document, edit it, dump it, and the bytes you didn't touch round-trip exactly — comments, whitespace, string style, and number formatting all intact.

Supports TOML 1.1.

import tomlrt

with open("pyproject.toml", "rb") as f:
    doc = tomlrt.load(f)

doc["project"]["version"] = "0.2.0"
doc["project"]["dependencies"].append("requests>=2")

print(tomlrt.dumps(doc))   # comments and layout are preserved

Build a document from scratch:

from tomlrt import Document, dumps

doc = Document({"project": {"name": "demo", "version": "0.1.0"}})
print(dumps(doc))

Documentation

Full docs at https://dimbleby.github.io/tomlrt/.

Wheel compatibility matrix

Platform Python 3
any

Files in release

Extras: None
Dependencies:
typing_extensions (>=4)