GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - t-strings/awesome-t-strings

BranchesTags
Open more actions menu

Latest commit

 

History

29 Commits
29 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
scripts
scripts
 
 
.gitignore
.gitignore
 
 
CODE_OF_CONDUCT.md
CODE_OF_CONDUCT.md
 
 
CONTRIBUTING.md
CONTRIBUTING.md
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 

Repository files navigation

Awesome T-Strings Awesome License: CC0-1.0 PRs Welcome

A curated list of resources, tools, libraries, and examples for Python's Template Strings (t-strings) introduced in Python 3.14

Template strings (t-strings) are a powerful new Python feature defined in PEP 750 that extends f-strings with programmable string processing capabilities. They enable safer string interpolation, prevent injection attacks, and allow for custom domain-specific languages.

Contents

  • What are T-Strings?
  • Official Resources
  • Development Tools
    • Linting & Static Analysis
    • Type Checking
    • IDE Extensions
    • Environment & Installation
  • Libraries & Frameworks
    • Database & SQL
    • HTML
    • Internationalization
    • Utilities
  • Learning Resources
    • Tutorials & Videos
    • Community Discussions
  • Getting Started
  • Related
  • Contributing

What are T-Strings?

Template strings (t-strings) are a new Python feature that provide programmable string interpolation. Unlike f-strings which immediately produce a string, t-strings return a structured template object that can be processed by custom functions. This enables:

  • Security: Prevent injection attacks through controlled processing
  • Flexibility: Create custom DSLs for any domain (SQL, HTML, logging, etc.)
  • Rendering control: Interpolations evaluate eagerly, and Template objects keep literal segments plus evaluated values separate via .strings, .interpolations, and .values so downstream renderers can combine them explicitly and safely
  • Type checking: Growing support in type checkers

Basic Examples (from PEP 750)

# Template strings use 't' prefix instead of 'f'
template: Template = t"Hello {name}"

# HTML auto-escaping example
# Note: html() is a hypothetical function from PEP 750, not part of stdlib.
# See https://github.com/t-strings/pep750-examples for a working implementation.
evil = "<script>alert('evil')</script>"
template = t"<p>{evil}</p>"
assert html(template) == "<p>&lt;script&gt;alert('evil')&lt;/script&gt;</p>"

# HTML attributes from dictionary
attributes = {"src": "shrubbery.jpg", "alt": "looks nice"}
template = t"<img {attributes} />"
assert html(template) == '<img src="shrubbery.jpg" alt="looks nice" />'

# Accessing template components
name = "World"
template = t"Hello {name}"
assert template.strings == ("Hello ", "")
assert template.interpolations[0].value == "World"
assert template.interpolations[0].expression == "name"

Learn more in PEP 750.

Official Resources

  • PEP 750: Template Strings - The official specification defining t-strings syntax and semantics
  • Template strings docs (string.templatelib) - Canonical documentation for the Template API in 3.14
  • Python 3.14.0 - Official release with template string support
  • PEP 745: Python 3.14 Release Schedule - Official timeline for 3.14.0, released October 7, 2025
  • Python 3.14 documentation - Latest docs covering template strings and string.templatelib
  • t-strings.help - Documentation and help site maintained by the PEP 750 core team

Development Tools

Linting & Static Analysis

  • t-linter - Comprehensive linting tool for t-strings with IDE integrations, including html and thtml language support
    • PyPI Package - pip install t-linter

Type Checking

  • Pyright 1.1.402 - Upstream release with first-class PEP 750 template string analysis (no fork required)
  • mypy 1.19.1 release notes - Fails gracefully on unsupported template strings while full checking support is developed

IDE Extensions

  • VS Code T-Linter - Syntax highlighting, linting, and IntelliSense for t-strings with html and thtml language support
  • PyCharm T-Linter Plugin - Full IDE support for JetBrains products with html and thtml language support (Source)

Environment & Installation

  • uv - Fast Python package manager with built-in Python version management
  • Python Docker Images - Official Python images (3.14 tags available)
  • CPython Source - Build Python 3.14 from source

Libraries & Frameworks

Database & SQL

  • sql-tstring - Safe SQL query building with t-strings, including optional clause rewriting and dialect support (pip install sql-tstring)
  • t-sql - Lightweight SQL templating that turns t-strings into parameterized queries, supporting qmark, numeric, named, format, and pyformat styles on Python 3.14+
  • psycopg 3 template string queries - Template string query execution in psycopg 3.3, supporting parameterized queries with t-strings (pip install psycopg[binary])

HTML

  • tstring-html - Parser-first HTML and T-HTML backends for t-strings with automatic escaping, class normalization, spread attributes, and JSX-style components via Rust-powered parsing
  • ludic - Lightweight HTML templating library and web framework with t-strings support
  • pyhtml-enhanced - Build HTML documents in type-safe Python with a simple and learnable syntax, including t-string support
  • tdom - A 🤘 rockin' t-string HTML templating system for Python 3.14 by co-author team.

Internationalization

  • gettext-tstrings - Safe gettext and Babel integration for t-strings: full-sentence msgids, translator-safe placeholder validation, and standard PO/MO catalogs via pybabel (pip install gettext-tstrings)

Utilities

  • better-dedent - Enhanced string dedenting for cleaner template formatting
  • tstr - Cross-version compatible t-strings with backport support for older Python versions, plus utilities for rendering, interpolation handling, and extensions for HTML escaping, SQL, and logging.
  • tstringlogger - Use t-strings as log messages. The power of late serialization with the readability of f-strings!
  • tstring-structured-data - Parser-first JSON, TOML, and YAML backends for t-strings with Rust-powered validation, supporting both parsed data and formatted text output.
  • tstring-util - Rendering helpers for Template objects, including lazy !fn handlers plus safe splitting and path utilities
  • regex-template - Auto-escapes regular expression interpolations

Learning Resources

Tutorials & Videos

  • Python Template Strings Introduction - Video tutorial on t-strings basics
  • Template Strings Advanced Usage - Advanced patterns and use cases

Community Discussions

  • Language hints for PEP 750 - Discussion on syntax highlighting and language detection
  • PEP 750 template strings new updates - Latest updates and changes to the specification
  • Template strings in stdlib logging - Integration with Python's logging module
  • Original PEP 750 discussion - Initial proposal and community feedback
  • Convert function for string.Template - Bridging classic templates with t-strings

Getting Started

Installation

To start using t-strings, you'll need Python 3.14 or later:

# Using uv package manager
uv python install 3.14

# Using Docker
docker run -it python:3.14

# Build from source
git clone https://github.com/python/cpython.git
cd cpython
git checkout v3.14.0
./configure --enable-optimizations
make -j4  # Or use $(nproc) on Linux, $(sysctl -n hw.ncpu) on macOS
sudo make altinstall

Related

  • PEP 787: Safer Subprocess Usage - Deferred to Python 3.15; proposes t-strings support for subprocess/shlex
  • Python f-strings - The predecessor to t-strings
  • Template Literal (JavaScript) - Similar concept in JavaScript
  • Tagged Template Literals - JavaScript's equivalent feature

Contributing

Contributions are welcome! Please read our Contributing Guidelines before submitting PRs.

How to Contribute

  1. Check for existing entries before adding new ones
  2. Test all code examples with Python 3.14+
  3. Verify all links are working
  4. Follow the established format
  5. Add meaningful descriptions

See CONTRIBUTING.md for detailed guidelines.

License

CC0

This work is licensed under a Creative Commons Zero v1.0 Universal License.

About

No description, website, or topics provided.

Resources

Readme
MIT license

Code of conduct

Code of conduct

Contributing

Contributing
Activity
Custom properties

Stars

74 stars

Watchers

5 watching

Forks

6 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.