Kida uses Jinja2-compatible syntax with extensions. If you are evaluating Python template engines, this page shows what carries over from Jinja2, what changes, and where Kida fits best.
Syntax
Unified Block Endings
Kida uses{% end %}for all blocks:
{% if condition %}
content
{% end %}
{% for item in items %}
{{ item }}
{% end %}
Pipeline Operator
Kida uses|> for pipelines (Jinja2 uses |):
{{ title |> escape |> upper |> truncate(50) }}
Pattern Matching
{% match status %}
{% case "active" %}
Active
{% case "pending" %}
Pending
{% case "error" %}
Error
{% case _ %}
Unknown
{% end %}
Block Caching
{% cache "sidebar-" ~ user.id %}
{{ render_sidebar(user) }}
{% end %}
Features
| Feature | Kida |
|---|---|
| Compilation | AST → AST |
| Rendering | StringBuilder O(n) |
| Free-threading | Native (PEP 703, Python 3.14t+) |
| Dependencies | Zero |
| Block endings | Unified{% end %} |
| Profiling | Opt-inprofiled_render() |
| Pattern matching | {% match %} |
| Block caching | {% cache %} |
| Async | Native |
When to Use Kida
- Need a Python template engine for HTML rendering and reusable components
- Want a Jinja2 alternative with familiar syntax
- Need free-threading support (Python 3.14t)
- Want zero dependencies
- Prefer unified block syntax
- Need built-in caching
- Want pattern matching in templates
- Value AST-native compilation
- Work with dict-heavy contexts
- Need built-in render profiling
Limitations
- No LaTeX/RTF output formats
- Jinja2-specific extensions may not be available
See Also
- Performance — Benchmarks
- Architecture — How Kida works
- Tutorials — Migration guides