Kida Syntax and Features

Kida's syntax and when it fits

1 min read 269 words

Kida uses Jinja2-compatible syntax with extensions. Key differences for migration.

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 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