Kida 0.3.0

Terminal rendering mode, framework integrations, sandbox, coverage, a11y linting, formatter, extensions

Released 2026-03-26.

Kida 0.3.0 is a major feature release introducing terminal rendering mode, framework integrations for Flask/Starlette/Django, a sandboxed environment, template coverage, accessibility linting, a template formatter, and an extension/plugin architecture.

Highlights

  • Terminal rendering modeEnvironment(autoescape="terminal")enables declarative CLI/TUI output with ANSI-safe escaping, 30+ terminal filters, built-in components, and color depth fallback.
  • Framework integrations — Drop-inkida.contribadapters for Flask, Starlette/FastAPI, and Django.
  • SandboxSandboxedEnvironmentwith configurable security policies for untrusted templates.
  • CoverageCoverageCollectortracks template line execution with LCOV/Cobertura export.
  • Accessibility linting — Static checks forimg-alt, heading-order, html-lang, input-label.
  • Template formatterkida fmtfor opinionated template formatting.
  • Extensions — Plugin architecture for custom tags withExtensionbase class.

Added

Terminal Rendering

  • autoescape="terminal" — One flag activates terminal mode with ANSI-safe escaping.
  • 30+ terminal filters — Colors (fg, bg, bold, dim, italic, underline), layout (table, tree, cols, rule), data (badge, diff, progress, sparkline), and more.
  • Built-in componentspanel, header, footer, connector, row, cols, rule, banner— all width-aware with truncation safety.
  • WidthStrategy — Configurable character width handling with terminal probe auto-detection, wcwidth support, and East Asian ambiguous width setting.
  • Color depth fallbackfg()/bg()degrade gracefully across truecolor, 256-color, basic, and no-color terminals.
  • LiveRenderer — In-place terminal re-rendering with Spinneranimation support.
  • stream_to_terminal() — Progressive chunk-by-chunk terminal output.
  • Responsivestack() — Side-by-side when terminal is wide, stacked when narrow.
  • kida render CLIkida render template.txt --data context.json [--stream].
  • Icon/box-drawing sets — Unicode and ASCII degradation with VS15 text presentation selectors.

Framework & Security

  • kida.contrib.flask — Flask integration adapter.
  • kida.contrib.starlette — Starlette/FastAPI integration adapter.
  • kida.contrib.django — Django template backend.
  • SandboxedEnvironment — Restricts collection methods to read-only by default; call-time safety checking blocks unsafe types;allow_mutating_methods and allow_callingallowlists.
  • CSP nonce supportinject_csp_nonce() and csp_nonce_filterfor Content Security Policy.

Tooling

  • CoverageCollector — Tracks template line execution with LCOV and Cobertura output. Thread-safe with module-level locking for concurrent usage.
  • Accessibility lintingimg-alt, heading-order, html-lang, input-labelchecks.
  • Template type checker{% template %}declarations for context type annotations.
  • Template formatterkida fmtwith configurable blank lines and indentation.
  • Extension architectureExtension base class with node_typesregistration and compiler dispatch via_extension_compilers.
  • Content stacks/portals{% push %} / {% stack %}for CSS/JS aggregation.
  • StreamTransform — Progressive rendering transform for streaming output.
  • UnifiedNodeVisitor/NodeTransformer — MRO-aware dispatch cache.

Changed

  • Immutable AST — Frozen-dataclass nodes with structural equality.
  • RenderContext — Free-threading safe, no shared mutable state.
  • Exception hierarchy — Extracted tokida.exceptionswith source-context-aware error classes.
  • Compiler optimizations — Constant folding, output coalescing, copy-on-write AST transforms, hoisted dispatch tables, compile-time rebinding tracking.

Upgrade Notes

  1. No breaking template or API changes for existingrender() / get_template()usage.
  2. Terminal mode is opt-in viaautoescape="terminal" or terminal_env().
  3. Framework adapters are inkida.contrib— import and configure for your framework.
  4. SandboxedEnvironment is a drop-in replacement for Environmentwhen running untrusted templates.