A format-preserving TOML parser and writer for Python.
Project description
tomlrt
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
Table is a real dict[str, Any] subclass and Array is a real
list[Any] subclass, so isinstance(t, dict), **t, json.dumps(t)
and any other API typed against dict / list accept tomlrt
containers directly — no snapshot dance.
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tomlrt-0.2.0.tar.gz.
File metadata
- Download URL: tomlrt-0.2.0.tar.gz
- Upload date:
- Size: 114.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5f5705682fbfe398390a55766f9188046e8f8125ab842937a9b391343b8f4b72
|
|
| MD5 |
c81b45cc5eb433de83f0a249d2bcb6d2
|
|
| BLAKE2b-256 |
f1b8679a7832091d3def2d129d3d330c194a2155a6340bd3bc5f54a8dc6bb130
|
Provenance
The following attestation bundles were made for tomlrt-0.2.0.tar.gz:
Publisher:
publish.yml on dimbleby/tomlrt
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tomlrt-0.2.0.tar.gz -
Subject digest:
5f5705682fbfe398390a55766f9188046e8f8125ab842937a9b391343b8f4b72 - Sigstore transparency entry: 1343343933
- Sigstore integration time:
-
Permalink:
dimbleby/tomlrt@681c4c98ab7f788018f1aee151bf399c92265f06 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/dimbleby
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@681c4c98ab7f788018f1aee151bf399c92265f06 -
Trigger Event:
push
-
Statement type:
File details
Details for the file tomlrt-0.2.0-py3-none-any.whl.
File metadata
- Download URL: tomlrt-0.2.0-py3-none-any.whl
- Upload date:
- Size: 50.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f7c65883076bbdc49da1cd85a29ea88d21c2ddeb3c809ac1ba4ee7e7d42bf83c
|
|
| MD5 |
e4e94f595841ce550731e5fc9de59055
|
|
| BLAKE2b-256 |
d17657179812cb5c282c298a28e753b3bfd94f5025fd19faec5f7b68d2656c3d
|
Provenance
The following attestation bundles were made for tomlrt-0.2.0-py3-none-any.whl:
Publisher:
publish.yml on dimbleby/tomlrt
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tomlrt-0.2.0-py3-none-any.whl -
Subject digest:
f7c65883076bbdc49da1cd85a29ea88d21c2ddeb3c809ac1ba4ee7e7d42bf83c - Sigstore transparency entry: 1343343961
- Sigstore integration time:
-
Permalink:
dimbleby/tomlrt@681c4c98ab7f788018f1aee151bf399c92265f06 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/dimbleby
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@681c4c98ab7f788018f1aee151bf399c92265f06 -
Trigger Event:
push
-
Statement type: