Skip to main content

A format-preserving TOML reader and writer for Python.

Project description

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/.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tomlrt-2.0.0.tar.gz (323.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tomlrt-2.0.0-py3-none-any.whl (135.7 kB view details)

Uploaded Python 3

File details

Details for the file tomlrt-2.0.0.tar.gz.

File metadata

  • Download URL: tomlrt-2.0.0.tar.gz
  • Upload date:
  • Size: 323.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for tomlrt-2.0.0.tar.gz
Algorithm Hash digest
SHA256 a2a249de01d3d28f359fda071ed4fe6d4cc4a53a18a11ac39d539b91b560f93f
MD5 463f0fe3bdeb00e277be32395bb63a64
BLAKE2b-256 92b98198482b84758d1661e0cd9f80e8c92114ec9c59cf132ddef376e4321ad1

See more details on using hashes here.

Provenance

The following attestation bundles were made for tomlrt-2.0.0.tar.gz:

Publisher: publish.yml on dimbleby/tomlrt

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tomlrt-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: tomlrt-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 135.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for tomlrt-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b34f6a0a3f174058e6d623e50c0435145e3e389a7488c955d95feceeea287a89
MD5 71bb7fe0062a57e2f76f1089102a6298
BLAKE2b-256 0d2a1338b9397c5d0d1ab12484023baea1ff22a5dbca2b16f779d35c71f9d8d2

See more details on using hashes here.

Provenance

The following attestation bundles were made for tomlrt-2.0.0-py3-none-any.whl:

Publisher: publish.yml on dimbleby/tomlrt

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page