TOML renderer for t-string structured data templates
Project description
toml-tstring
TOML rendering for PEP 750 t-strings. Parsing and rendering happen in Rust; this package is the Python wrapper.
Requires Python 3.14+.
This package depends on tstring-bindings, a native PyO3 extension. On
supported platforms, install from prebuilt wheels. Other environments require a
local Rust 1.94.0 toolchain build.
API
render_data(template, profile="1.1") # -> Python data
render_text(template, profile="1.1") # -> TOML text
render_result(template, profile="1.1") # -> RenderResult (.text + .data)
Type alias: TomlProfile = Literal["1.0", "1.1"]
Parsed template structure is cached per process using template.strings +
profile as the key. Use profile="1.0" when you need the stricter TOML 1.0
behavior.
How it works
The Python Template is converted to a Rust token stream and parsed into TOML
nodes -- assignments, key paths, headers, arrays, inline tables, literals, and
string families all become explicit nodes with interpolation preserved.
Rendering is driven by the parsed node type. The Rust toml crate handles
value materialization and normalization.
Supported positions
- whole-value, key, dotted-key, table-header, and array-of-table interpolation
- string-fragment interpolation across all four TOML string types
- nested arrays, inline tables, and array-of-table sections
- integer forms (hex, binary, octal), special floats (
inf,nan) datetime,date, andtimevalues
Limits
Nonerejected (TOML has no null)- offset
timevalues rejected - integers must fit signed 64-bit range
- values must be TOML-representable
Verify
uv sync --group dev
uv run --group dev pytest
See also
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
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 toml_tstring-0.2.1.tar.gz.
File metadata
- Download URL: toml_tstring-0.2.1.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a83ad8a90b788afa87b2c834c311801a7756043509305b42ed5e55e283d53902
|
|
| MD5 |
de614a996d126d1560ead9a1b98336ee
|
|
| BLAKE2b-256 |
23d5f43b635d43c2a1de8449527f8ae224f758b0fc66c9562107a88db0cab5a1
|
Provenance
The following attestation bundles were made for toml_tstring-0.2.1.tar.gz:
Publisher:
publish-python.yml on koxudaxi/tstring-structured-data
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
toml_tstring-0.2.1.tar.gz -
Subject digest:
a83ad8a90b788afa87b2c834c311801a7756043509305b42ed5e55e283d53902 - Sigstore transparency entry: 1131192278
- Sigstore integration time:
-
Permalink:
koxudaxi/tstring-structured-data@f30a5879992d51c603f91ca9464a80fe2da3a55c -
Branch / Tag:
refs/tags/0.2.1 - Owner: https://github.com/koxudaxi
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-python.yml@f30a5879992d51c603f91ca9464a80fe2da3a55c -
Trigger Event:
push
-
Statement type:
File details
Details for the file toml_tstring-0.2.1-py3-none-any.whl.
File metadata
- Download URL: toml_tstring-0.2.1-py3-none-any.whl
- Upload date:
- Size: 4.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4efc6f2f85e8bbee11011ac96d680497fdcd2b45ce8b2d98de999873f4c15d8f
|
|
| MD5 |
1cf72d6ed2331c242f96f4a9f680fe18
|
|
| BLAKE2b-256 |
9c20df38faef46b59f61f8eb69be4a788e35cc0d121494c68347b9baef438e0a
|
Provenance
The following attestation bundles were made for toml_tstring-0.2.1-py3-none-any.whl:
Publisher:
publish-python.yml on koxudaxi/tstring-structured-data
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
toml_tstring-0.2.1-py3-none-any.whl -
Subject digest:
4efc6f2f85e8bbee11011ac96d680497fdcd2b45ce8b2d98de999873f4c15d8f - Sigstore transparency entry: 1131192319
- Sigstore integration time:
-
Permalink:
koxudaxi/tstring-structured-data@f30a5879992d51c603f91ca9464a80fe2da3a55c -
Branch / Tag:
refs/tags/0.2.1 - Owner: https://github.com/koxudaxi
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-python.yml@f30a5879992d51c603f91ca9464a80fe2da3a55c -
Trigger Event:
push
-
Statement type: