larztemplate
A tiny template engine — fill placeholders, loop and branch, render HTML.
Every real app builds strings from data: web pages, emails, config files. Rather
than messy string concatenation, you use a template. larztemplate is a small but
genuine template engine — {{ variables }}, {% for %} loops and {% if %}
branches — so you can generate HTML and text cleanly, and understand how
templating actually works. Zero dependencies.
Install
pip install larztemplate
Use
from larztemplate import render
render("Hello, {{ name }}!", {"name": "Ada"})
render("{% for x in items %}{{ x }} {% endfor %}", {"items": [1, 2, 3]})
render("{% if admin %}welcome boss{% else %}hi{% endif %}", {"admin": True})
render("<p>{{ msg }}</p>", {"msg": "<b>hi</b>"}, escape=True) # escapes the value
Learn to code with Larz
Part of the learn-to-code toolkit in the Larz stack — see the Learn to Code platform. A building block for real apps, and a readable example of parsing and rendering.
Tests
python -m unittest discover -s tests -v # 9 tests
License
MIT (c) larz-scripter
Metadata
Release files for larztemplate 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| larztemplate-0.1.0.tar.gz | 10.3 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| larztemplate-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 20.9 kB
Release files / larztemplate-0.1.0.tar.gz
| Download URL | larztemplate-0.1.0.tar.gz |
|---|---|
| Size | 10.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9f2445e1865a6659c8df3d981406fdb78091067f8e4d3e63591a5f7fcf49ad24
|
|
BLAKE2b-256 checksum How to use checksums |
92d8d18a183f84f71ea3c7f862307df3244c9b4dd30f423c082da827d801c783
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.13
|
Release files / larztemplate-0.1.0-py3-none-any.whl
| Download URL | larztemplate-0.1.0-py3-none-any.whl |
|---|---|
| Size | 10.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cc1342540a452dc90eea2cf9bc346b49c792812406a43f1532dcc81d0fa0d841
|
|
BLAKE2b-256 checksum How to use checksums |
cb7f58b91f1c6cf206b3bb1bd589546d280edef478e3f7137f5fc3528957bd2c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.13
|
Security for larztemplate 0.1.0
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.