Skip to main content

yaml-tstring

YAML 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.2.2")  # -> Python data (list for multi-doc)
render_text(template, profile="1.2.2")  # -> YAML text
render_result(template, profile="1.2.2")  # -> RenderResult (.text + .data)

Type alias: YamlProfile = Literal["1.2.2"]

Parsed template structure is cached per process using template.strings + profile as the key.

How it works

The Python Template is converted to a Rust token stream and parsed by an interpolation-aware YAML scanner/parser. Block mappings, block sequences, flow collections, scalar styles, anchors, aliases, and tags are all parsed explicitly in Rust with interpolation nodes preserved. saphyr handles data materialization and normalization.

Supported positions

  • mapping-key interpolation
  • plain, single-quoted, double-quoted, and block scalar assembly
  • anchor, alias, and tag interpolation (including verbatim !<...> tags)
  • block and flow collections, multi-document streams
  • directives, %TAG handles, explicit document markers
  • merge keys, complex keys, trailing commas in flow collections
  • YAML 1.2.2 escape sequences in double-quoted scalars

The full tested boundary is in the backend support matrix.

Limits

  • non-finite floats rejected
  • metadata fragments must be non-empty and whitespace-free
  • integers keep exact Python text (no silent float coercion)
  • values must be representable in the current YAML 1.2+ surface

Verify

uv sync --group dev
uv run --group dev pytest

See also

Metadata

Release files for yaml-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 yaml-tstring 0.2.2
File Size Uploaded
yaml_tstring-0.2.2.tar.gz 3.6 kB Details

Built distribution (wheel)

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

Total release size: 8.2 kB

Release files / yaml_tstring-0.2.2.tar.gz

Download URL yaml_tstring-0.2.2.tar.gz
Size 3.6 kB
Tags Source
SHA-256 checksum
How to use checksums
d529d5d383cc09961a7d1f43270296af9613a52d78d221c9743e19606dfb0668
BLAKE2b-256 checksum
How to use checksums
155bd3db73a5b0088eff14fce31134cc421a7b6b2f3d17317458cc3d1e8b5eb2
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 / yaml_tstring-0.2.2-py3-none-any.whl

Download URL yaml_tstring-0.2.2-py3-none-any.whl
Size 4.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e33d6fa6a96e91414880a249b9843871d18f39f6ce7c409357cfef51f3e78bed
BLAKE2b-256 checksum
How to use checksums
84eb1c6efed65993ffb999421741eb232059bd67eae4fd8bb14315fac1f00b2c
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