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.2.tar.gz (329.1 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.2-py3-none-any.whl (132.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: tomlrt-2.0.2.tar.gz
  • Upload date:
  • Size: 329.1 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.2.tar.gz
Algorithm Hash digest
SHA256 86d013ccc49222dca625909b08a5726deb1ba17ca53ff98032bbad56fcc3abf6
MD5 7ed9bc1fe00c4142c028e7e50e7b514c
BLAKE2b-256 5d77321a520541f5d611d8a70d2fb9c7a2676819b2f12f5a3c5dcdc30c79a90a

See more details on using hashes here.

Provenance

The following attestation bundles were made for tomlrt-2.0.2.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.2-py3-none-any.whl.

File metadata

  • Download URL: tomlrt-2.0.2-py3-none-any.whl
  • Upload date:
  • Size: 132.4 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 faca0d6ed8965a80e1241c4d918eec16d7a9c64e4dca5a322ebd36699411048a
MD5 ff28b49814515ad246c160cd62518afd
BLAKE2b-256 1af21559ceeb1f4969fec287a3952ee0dedef31b765cd323cf785b501722b82d

See more details on using hashes here.

Provenance

The following attestation bundles were made for tomlrt-2.0.2-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