Skip to main content

A format-preserving TOML parser and writer for Python.

Project description

tomlrt

PyPI Python versions License CI Docs

A format-preserving TOML parser 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.

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:

import tomlrt

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

Documentation

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

See also the changelog.

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-1.0.2.tar.gz (197.7 kB view details)

Uploaded Source

Built Distribution

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

tomlrt-1.0.2-py3-none-any.whl (78.7 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for tomlrt-1.0.2.tar.gz
Algorithm Hash digest
SHA256 949e3092d5dec14430c84762bbe14cceb32e822c893aba5071ea12ad4095cd97
MD5 a519a72523ea13a7b95e3ee888741de8
BLAKE2b-256 06f135c28695c2cdc5b0127fccdd67ba69ca9b2e625e2121329d1aa144df23df

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: tomlrt-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 78.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-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 0bd2375e9c631133855710f66f7b81ccf3166273ccba7d6acd288028244fe328
MD5 f829762cc1fbc8736c71017676a2c6a7
BLAKE2b-256 dc211a04ee7deadc00b55b47f80510dfbd9428a2a9ee919d490a1d4559c4ad3e

See more details on using hashes here.

Provenance

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