Released: January 2026
Initial public release of Kida.
Highlights
- 🚀 AST-native compilation — Templates compile to Python AST directly
- )彡 Free-threading ready — PEP 703 compliant for Python 3.14t
- 🎯 Zero dependencies — Pure Python with built-in Markup class
- ✨ Modern syntax — Unified
{% end %}, pattern matching, pipelines
Features
Core
Environmentclass for template configurationTemplateclass with sync and async renderingFileSystemLoaderfor filesystem templatesDictLoaderfor in-memory templates- Template caching with LRU eviction
- Bytecode cache for cold-start performance
- Fragment caching with
{% cache %}directive
Syntax
- Variable output:
{{ expression }} - Control flow:
{% if %},{% for %},{% match %} - Unified block endings:
{% end %} - Template inheritance:
{% extends %},{% block %} - Includes:
{% include %} - Functions/macros:
{% def %},{% macro %} - Pipeline operator:
{{ x |> filter1 |> filter2 }}
Filters
50+ built-in filters including:
- String:
upper,lower,trim,truncate,replace - Collections:
first,last,sort,unique,groupby - HTML:
escape,safe,striptags - Numbers:
abs,round,filesizeformat - Utility:
default,tojson,debug
Tests
20+ built-in tests including:
- Type:
defined,string,number,sequence,mapping - Boolean:
true,false - Number:
odd,even,divisibleby - Comparison:
eq,lt,gt,in
Error Handling
TemplateError— Base exceptionTemplateSyntaxError— Parse errors with line numbersTemplateNotFoundError— Missing templatesUndefinedError— Undefined variables
Requirements
- Python 3.14+
- No runtime dependencies
Installation
pip install kida
Getting Started
from kida import Environment
env = Environment()
template = env.from_string("Hello, {{ name }}!")
print(template.render(name="World"))
# Output: Hello, World!