Skip to main content

json-tstring

JSON 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="rfc8259")  # -> Python data
render_text(template, profile="rfc8259")  # -> JSON text
render_result(template, profile="rfc8259")  # -> RenderResult (.text + .data)

Type alias: JsonProfile = Literal["rfc8259"]

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, parsed into JSON nodes (keeping interpolation visible in values, keys, and string fragments), and rendered back to text or Python data. serde_json handles normalization.

Supported positions

  • whole-value, object-key, quoted-key-fragment, and string-fragment interpolation
  • bare fragments promoted to JSON strings
  • nested arrays and objects, top-level values

Limits

  • object keys must be str
  • non-finite floats rejected
  • values must be JSON-representable
  • integers keep exact Python text (no silent float coercion)

Verify

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

See also

Metadata

Release files for json-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 json-tstring 0.2.2
File Size Uploaded
json_tstring-0.2.2.tar.gz 3.3 kB Details

Built distribution (wheel)

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

Total release size: 7.8 kB

Release files / json_tstring-0.2.2.tar.gz

Download URL json_tstring-0.2.2.tar.gz
Size 3.3 kB
Tags Source
SHA-256 checksum
How to use checksums
ca47c301a0ab23e8b6e68789399742f2338ac0a0c73afbd2322a2cbf5f617cd3
BLAKE2b-256 checksum
How to use checksums
5d70c7e9c2ccfebc739fd0d854faa9a5818e8f405282d53acb6c616a88cd653c
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 / json_tstring-0.2.2-py3-none-any.whl

Download URL json_tstring-0.2.2-py3-none-any.whl
Size 4.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d30357975ecc082d81ade30972972c3f5ecc8d2ee07c39d76a97d6ff205f1bec
BLAKE2b-256 checksum
How to use checksums
76e061365cafad6c07fbc6d62c3d1315adb849a01c1e6979d61a1791a60a0a81
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