Kida 0.4.0

list comprehensions, error boundaries, i18n trans blocks, scoped slots, and a two-phase partial evaluator

Released 2026-04-10.

Kida 0.4.0 is the biggest feature release since the project's inception — list comprehensions, error boundaries, i18n with Babel extraction, scoped slots, and a two-phase partial evaluator that widens the compile-time optimization surface.

Highlights

  • List comprehensions[x.name for x in users if x.active]works natively in template expressions.
  • Error boundaries{% try %}blocks catch render errors and fall back to safe defaults without aborting the whole page.
  • i18n{% trans %}blocks — Full internationalization support with pluralization, variable interpolation, and Babel-compatible message extraction.
  • Scoped slots — Components can expose data back to the caller via{% slot name expose x, y %}.
  • Two-phase partial evaluator — Constant folding, dead branch elimination, and loop unrolling at compile time for measurable render speedups.

Added

Expressions

  • List comprehensions[expr for var in iterable if condition]with full parser, compiler, analysis (dependency tracking, purity), and CLI integration. (#62)

Template Control Flow

  • Error boundaries{% try %}...{% fallback %}...{% end %}catches exceptions during rendering and substitutes fallback content. Integrates with the environment's error handler. (#61)
  • Scoped slots{% slot name expose x, y %}lets parent components bind slot-exposed variables, enabling inversion-of-control patterns. (#61)

Internationalization

  • {% trans %} / {% pluralize %}blocks — Mark translatable strings with variable interpolation and plural forms. The compiler generatesgettext/ngettextcalls. (#61)
  • Babel extractionkida.babel.extract entry point lets pybabel extractpull translatable strings from Kida templates. (#63)
  • kida i18n CLIkida i18n extract and kida i18n analyzecommands for standalone message extraction and translation coverage analysis. (#63)
  • Analysis integration — i18n analysis module tracks translatable strings, detects missing translations, and integrates with the dependency and purity analyzers. (#63)

Compiler

  • Partial evaluator phase 1 — Constant folding, filter inlining for pure built-in filters, dead branch elimination, and loop unrolling for small static iterables. Configurable via Environment(partial_eval=True)with per-strategy controls. (#64)
  • Partial evaluator phase 2 — Extends optimization to conditional expressions, nested structures, string operations, comprehension folding, and cross-block constant propagation. (#65)
  • kida compile --optimizeCLI — Inspect the optimized AST and see before/after comparisons. (#64, #65)

Changed

  • Performance docs — Updated to cover partial evaluation strategies and benchmarks. (#64)
  • Compiler docs — New sections on the optimization pipeline and custom filter purity. (#64)
  • Configuration docs — Documentspartial_evaland related environment options. (#64)

Upgrade Notes

  1. No breaking changes. Drop-in upgrade from 0.3.4.
  2. Partial evaluation is opt-in — enable withEnvironment(partial_eval=True).
  3. i18n requires no new dependencies; Babel integration is optional.
  4. GitHub Action version tag updated to@v0.4.0.