YAML renderer for t-string structured data templates
Project description
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,
%TAGhandles, 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
floatcoercion) - values must be representable in the current YAML 1.2+ surface
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 yaml_tstring-0.1.1.tar.gz.
File metadata
- Download URL: yaml_tstring-0.1.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 |
8fd4202b921c9c88cf5e997e54985e4c6d621af982c282f119c8779f517122bf
|
|
| MD5 |
a360cee1311312b887509d2182c9b506
|
|
| BLAKE2b-256 |
3f8c9e9a2f29b3f8078b9bab242f96229a4d74b6826d065b0ce4c80e70a19274
|
Provenance
The following attestation bundles were made for yaml_tstring-0.1.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:
yaml_tstring-0.1.1.tar.gz -
Subject digest:
8fd4202b921c9c88cf5e997e54985e4c6d621af982c282f119c8779f517122bf - Sigstore transparency entry: 1122328246
- Sigstore integration time:
-
Permalink:
koxudaxi/tstring-structured-data@5bb9082e6fcd2eb3a6e89999c84e51148aee9b37 -
Branch / Tag:
refs/tags/0.1.1 - Owner: https://github.com/koxudaxi
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-python.yml@5bb9082e6fcd2eb3a6e89999c84e51148aee9b37 -
Trigger Event:
push
-
Statement type:
File details
Details for the file yaml_tstring-0.1.1-py3-none-any.whl.
File metadata
- Download URL: yaml_tstring-0.1.1-py3-none-any.whl
- Upload date:
- Size: 4.7 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 |
e56ee955673b64952077292d581c969d3e4dfdc536d439ee049ff7ec8b1e9c4e
|
|
| MD5 |
7153396b5b95dfd413d339f2eae28c08
|
|
| BLAKE2b-256 |
e1025b52c92926a6288cbf35792a09169ede4c8965b6d02b4ccfa91524e92d7a
|
Provenance
The following attestation bundles were made for yaml_tstring-0.1.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:
yaml_tstring-0.1.1-py3-none-any.whl -
Subject digest:
e56ee955673b64952077292d581c969d3e4dfdc536d439ee049ff7ec8b1e9c4e - Sigstore transparency entry: 1122328295
- Sigstore integration time:
-
Permalink:
koxudaxi/tstring-structured-data@5bb9082e6fcd2eb3a6e89999c84e51148aee9b37 -
Branch / Tag:
refs/tags/0.1.1 - Owner: https://github.com/koxudaxi
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-python.yml@5bb9082e6fcd2eb3a6e89999c84e51148aee9b37 -
Trigger Event:
push
-
Statement type: