templating.integration

Page actions AI-ready formats and sharing
Open LLM text
Share with AI
Ask Claude Ask ChatGPT Ask Gemini Ask Copilot

Kida environment setup and app binding.

Creates a kida Environment from chirp's AppConfig and binds user-registered filters and globals. The environment is created once during App._freeze() and passed through the request pipeline.

Kida environment setup and app binding.

Creates a kida Environment from chirp's AppConfig and binds user-registered filters and globals. The environment is created once during App._freeze() and passed through the request pipeline.

templating.integration

Name Type Default Description
type
qualified_name
element_type
description
source_file
line_number
is_autodoc
autodoc_element
_autodoc_template
_autodoc_url_path
_autodoc_page_type
title
doc_content_hash

Symbols on this page

get_active_kida_env
function
def get_active_kida_env() -> Environment | None

Return the kidaEnvironment for the active request, or None.

Set byhandle_requestaround dispatch. Middleware uses this to render a template/block to HTML inside the pipeline (e.g. an HTML 429 body) without reaching back into the handler's negotiation path.

No parameters.

_is_chirp_ui_filter_override
function
def _is_chirp_ui_filter_override(name: str, func: Callable[..., Any]) -> bool

True when func is chirp-ui's implementation replacing chirp stubs for the UI kit.

Parameters

Name Type Default Description
name str
func Callable[..., Any]
create_environment
function
def create_environment(config: AppConfig, filters: dict[str, Callable[..., Any]], globals_: dict[str, Any], plugin_loaders: list | None = None) -> Environment

Create a kida Environment from app configuration.

Called once duringApp._freeze(). The returned environment is immutable for the lifetime of the app.

Supports multiple template directories viaconfig.component_dirs for component libraries, partials, and shared templates. Extra loaders (CMS, DB, state) are tried first when configured.

Package-provided templates (for example chirp-ui) are not discovered from installed packages. Explicit integrations such asuse_chirp_ui register their loaders viaApp.add_loader / plugin_loaders.

Parameters

Name Type Default Description
config AppConfig
filters dict[str, Callable[..., Any]]
globals_ dict[str, Any]
plugin_loaders list | None None
render_template
function
def render_template(env: Environment, tpl: Template) -> str

Render a full template to string.

Parameters

Name Type Default Description
env Environment
tpl Template
render_fragment
function
def render_fragment(env: Environment, frag: Fragment) -> str

Render a named block from a template to string.

RaisesBlockNotFoundError (a KeyErrorsubclass) when the named block does not exist in the template. Unifies the error contract across both OOB pipelines — region updates (PR #90) andOOB(...)return values both surface the same exception type with the same message shape.

Parameters

Name Type Default Description
env Environment
frag Fragment

View source · /home/runner/work/chirp/chirp/site/../src/chirp/templating/integration.py:1