Skip to main content

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, and time values

Limits

  • None rejected (TOML has no null)
  • offset time values 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

Metadata

Release files for toml-tstring 0.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for toml-tstring 0.2.2
File Size Uploaded
toml_tstring-0.2.2.tar.gz 3.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for toml-tstring 0.2.2
File Interpreter ABI Platform
toml_tstring-0.2.2-py3-none-any.whl Python 3 none any Details

Total release size: 8.1 kB

Release files / toml_tstring-0.2.2.tar.gz

Download URL toml_tstring-0.2.2.tar.gz
Size 3.5 kB
Tags Source
SHA-256 checksum
How to use checksums
4e0899899be4fb3d27c7cedb3b1bd584c53db5ef3221479ad308bc3fec574f25
BLAKE2b-256 checksum
How to use checksums
83ee50d4e338edf984d66b2c5706e4fabe0e3eff88c7dabe8e8c8e3e1abbd84d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 2, 2026.

Transparency log

Release files / toml_tstring-0.2.2-py3-none-any.whl

Download URL toml_tstring-0.2.2-py3-none-any.whl
Size 4.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
10f10c35bf28721e3374a5b3047a5d637393ed14af4bb3c63e07330d754ee89b
BLAKE2b-256 checksum
How to use checksums
19cc30fa0293858da7fdb18bece0fd71e686cdf99d0a505fcce6a5290d07165b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 2, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.2 This release

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page