# tomlrt

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.

```python
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
```

## Where next

- [Quickstart](<https://dimbleby.github.io/tomlrt/quickstart/index.md>) — parse, edit, dump.
- [Reading documents](<https://dimbleby.github.io/tomlrt/reading/index.md>) — look up values and convert to plain Python.
- [Building documents](<https://dimbleby.github.io/tomlrt/building/index.md>) — construct a `Document` from scratch or from a `dict`, and choose table and array forms.
- [Editing documents](<https://dimbleby.github.io/tomlrt/editing/index.md>) — set, replace, remove, and copy values.
- [Comments](<https://dimbleby.github.io/tomlrt/comments/index.md>) — read and write comments.
- [Layout](<https://dimbleby.github.io/tomlrt/layout/index.md>) — sort keys, arrange tables and arrays, and format spacing.
- [Errors](<https://dimbleby.github.io/tomlrt/errors/index.md>) — exception types.
- [API reference](<https://dimbleby.github.io/tomlrt/api/index.md>) — classes, methods, and options.
