Skip to main content

A format-preserving TOML parser and writer for Python.

Project description

tomlrt

PyPI Python versions License CI

A format-preserving TOML parser and writer for Python.

Usage

import tomlrt

# Files must be opened in binary mode.
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

Comment API

doc = tomlrt.loads("""
[server]
host = "localhost"  # default
port = 8080
""")

server = doc.table("server")
server.comments["port"] = "override with $PORT"
server.comments["host"] = None         # clear

print(tomlrt.dumps(doc))
# [server]
# host = "localhost"
# port = 8080 # override with $PORT

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

Uploaded Source

Built Distribution

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

tomlrt-0.1.0-py3-none-any.whl (40.5 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for tomlrt-0.1.0.tar.gz
Algorithm Hash digest
SHA256 249bd5a53c1b93dbc7a43e2cf4498880a95bc76f16e8d985309c6946028137b7
MD5 2306cfb28d52ef244a084d08063f5ee3
BLAKE2b-256 cefd689b32f8fb8751abe1f8058b7cc420179a62a0b9976d72823878b710c60f

See more details on using hashes here.

Provenance

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

File metadata

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

File hashes

Hashes for tomlrt-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2eb89d37641e0946c310a0e0a3741d8c03447860468c10fd5d36c4db633ae7ab
MD5 2292d1f88c4d676d87ff6081e86b979e
BLAKE2b-256 64aae19628138adc581dc98b243fbc3bf73fde6a8c6e2e81e1dc34769f0682ed

See more details on using hashes here.

Provenance

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