A curated list of resources, tools, libraries, and examples for Python's Template Strings (t-strings) introduced in Python 3.14
Warning
Template strings are accepted for Python 3.14 and available in release candidates. As of 3.14.0rc3 (2025-09-18) the syntax is stable; some ecosystem tools are still catching up. The Python 3.14.0 GA is scheduled for 2025-10-07, so verify against the 3.14 RCs before adopting broadly.
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.
- What are T-Strings?
- Official Resources
- Development Tools
- Libraries & Frameworks
- Learning Resources
- Getting Started
- Related
- Contributing
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
# Template strings use 't' prefix instead of 'f'
template: Template = t"Hello {name}"
# HTML auto-escaping example
evil = "<script>alert('evil')</script>"
template = t"<p>{evil}</p>"
assert html(template) == "<p><script>alert('evil')</script></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.
- PEP 750: Template Strings - The official specification defining t-strings syntax and semantics
- Template strings docs (
string.templatelib
) - Canonical documentation for theTemplate
API in 3.14 - Python 3.14.0rc3 - Final release candidate with template string support (syntax is stable)
- PEP 745: Python 3.14 Release Schedule - Official timeline for 3.14.0, targeting 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 author
- t-linter - Comprehensive linting tool for t-strings with IDE integrations
- PyPI Package -
pip install t-linter
- PyPI Package -
- Pyright 1.1.402 - Upstream release with first-class PEP 750 template string analysis (no fork required)
- mypy 1.18.2 release notes - Fails gracefully on unsupported template strings while full checking support is developed
- VS Code T-Linter - Syntax highlighting, linting, and IntelliSense for t-strings
- PyCharm T-Linter Plugin - Full IDE support for JetBrains products (Source)
- uv - Fast Python package manager with built-in Python version management
- Python Docker Images - Official Python images (3.14-rc tags available)
- CPython Source - Build Python 3.14 release candidate from source
- 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 - Experimental template string execution in psycopg 3.3 preview builds (installable from Test PyPI as
psycopg[binary]==3.3.0.dev1
) tested with Python 3.14 RC builds
- better-dedent - Enhanced string dedenting for cleaner template formatting
- tdom - A 🤘 rockin' t-string HTML templating system for Python 3.14 by co-author team.
- tstring-util - Rendering helpers for
Template
objects, including lazy!fn
handlers plus safe splitting and path utilities - regex-template - Auto-escapes regular expression interpolations
- Python Template Strings Introduction - Video tutorial on t-strings basics
- Template Strings Advanced Usage - Advanced patterns and use cases
- 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
To start using t-strings, you'll need Python 3.14 or later:
# Using uv package manager
uv python install 3.14.0rc3
# Using Docker
docker run -it python:3.14-rc
# Build from source
git clone https://github.com/python/cpython.git
cd cpython
git checkout v3.14.0rc3
./configure --enable-optimizations
make -j4 # Or use $(nproc) on Linux, $(sysctl -n hw.ncpu) on macOS
sudo make altinstall
- 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
Contributions are welcome! Please read our Contributing Guidelines before submitting PRs.
- Check for existing entries before adding new ones
- Test all code examples with Python 3.14+
- Verify all links are working
- Follow the established format
- Add meaningful descriptions
See CONTRIBUTING.md for detailed guidelines.
This work is licensed under a Creative Commons Zero v1.0 Universal License.