Kida
A Python template engine and Jinja2 alternative for HTML templates, streaming, and framework integration
Python Template Engine for Modern Templates
Jinja2 alternative. AST-native. Streaming-ready.
Kida is a pure-Python template engine for HTML templates, partials, and reusable components. It compiles templates directly to Python AST, supports block rendering and streaming output, and works well as a Jinja2 alternative for Python 3.14+ projects.
from kida import Environment
env = Environment()
template = env.from_string("Hello, {{ name }}!")
print(template.render(name="World"))
# Output: Hello, World!
Why Use Kida
Compiles templates toast.Moduleobjects directly. No string concatenation, no regex
parsing, no code-generation layer.
Built for Python 3.14t (PEP 703). Renders templates concurrently without the GIL. Declares_Py_mod_gil = 0.
Unified{% end %} for all blocks. Pattern matching with {% match %}. Pipelines with |>. Built-in caching.
Pure Python with no runtime dependencies. Includes nativeMarkupclass—no markupsafe required.
Common Use Cases
- Rendering HTML templates for web apps, static sites, and email output
- Replacing or evaluating Jinja2 in Python codebases
- Streaming template output for chunked responses and SSE
- Rendering blocks or regions for HTMX partials and layout composition
- Integrating template analysis and metadata into higher-level frameworks
Performance
StringBuilder rendering for O(n) concatenation:
# Kida: O(n) StringBuilder
_out.append(...)
return "".join(_out)
| Template Size | Time |
|---|---|
| Small (10 vars) | ~0.3ms |
| Medium (100 vars) | ~2ms |
| Large (1000 vars) | ~15ms |
Zero Dependencies
Kida is pure Python with no runtime dependencies:
[project]
dependencies = [] # Zero!
Includes a native Markupclass for safe HTML handling—no markupsafe required.
The Bengal Ecosystem
A structured reactive stack — every layer written in pure Python for 3.14t free-threading.
| ᓚᘏᗢ | Bengal | Static site generator | Docs |
| ∿∿ | Purr | Content runtime | — |
| ⌁⌁ | Chirp | Web framework | Docs |
| =^..^= | Pounce | ASGI server | Docs |
| )彡 | Kida | Template engine ← You are here | Docs |
| ฅᨐฅ | Patitas | Markdown parser | Docs |
| ⌾⌾⌾ | Rosettes | Syntax highlighter | Docs |
Python-native. Free-threading ready. No npm required.