Module

app.state

Application setup/runtime state containers.

Classes

PendingRoute 8
A route waiting to be compiled.

A route waiting to be compiled.

Attributes

Name Type Description
path str
handler Handler
methods list[str] | None
name str | None
referenced bool
template str | None
inline bool
page_source_handler Callable[..., Any] | None
PendingTool 3
A tool waiting to be compiled.

A tool waiting to be compiled.

Attributes

Name Type Description
name str
description str
handler Callable[..., Any]
MountAppSkip 3
One entry dropped during ``App.mount_app`` merge (parent-wins). Recorded on the parent's mutable s…

One entry dropped duringApp.mount_appmerge (parent-wins).

Recorded on the parent's mutable state so a contract check can surface it as an INFO issue in categorymount_app_merge— users see what their sub-app tried to register but was overridden.

Attributes

Name Type Description
kind str
key str
prefix str
InternalRouteSpec 8
Framework-owned URL surface published at freeze time.

Framework-owned URL surface published at freeze time.

Attributes

Name Type Description
path str
owner str
kind Literal['asset', 'api', 'page', 'sse', 'dispatcher']
transport Literal['javascript', 'json', 'html', 'sse']
enabled bool
visibility Literal['hidden', 'internal', 'user']
reserved_prefix str | None

Methods

owns 1 bool
Return whether this spec reserves *path*.
def owns(self, path: str) -> bool
Parameters
Name Type Description
path
Returns
bool
DebugInjectionSpec 6
One debug runtime browser bootstrap resource.

One debug runtime browser bootstrap resource.

Attributes

Name Type Description
name str
snippet str
asset_path str | None
before str
full_page_only bool
skip_htmx bool
InternalFeatureSpec 5
A native internal/debug feature and the routes/resources it owns.

A native internal/debug feature and the routes/resources it owns.

Attributes

Name Type Description
name str
enabled bool
reason str
route_paths tuple[str, ...]
injections tuple[DebugInjectionSpec, ...]
RuntimeDebugWiring 4
Frozen debug/internal wiring descriptor published with runtime state.

Frozen debug/internal wiring descriptor published with runtime state.

Attributes

Name Type Description
routes tuple[InternalRouteSpec, ...]
features tuple[InternalFeatureSpec, ...]
trace_store Any

Methods

internal_route_for_path 1 InternalRouteSpec | None
Return the internal route spec that owns *path*, if any.
def internal_route_for_path(self, path: str) -> InternalRouteSpec | None
Parameters
Name Type Description
path
Returns
InternalRouteSpec | None
MutableAppState 41
Mutable setup-time state.

Mutable setup-time state.

Attributes

Name Type Description
pending_routes list[PendingRoute]
pending_tools list[PendingTool]
middleware_list list[Middleware]
error_handlers dict[int | type, ErrorHandler]
template_filters dict[str, Callable[..., Any]]
template_globals dict[str, Any]
startup_hooks list[Callable[..., Any]]
shutdown_hooks list[Callable[..., Any]]
worker_startup_hooks list[Callable[..., Any]]
worker_shutdown_hooks list[Callable[..., Any]]
discovered_layout_chains list[Any]
lazy_pages_dir str | None
page_route_paths set[str]
page_leaf_templates set[str]
page_templates set[str]
pending_domains list[object]
providers dict[type, Callable[..., Any]]
reload_dirs_extra list[str]
db Database | None
migrations_dir str | None
custom_kida_env Environment | None
tool_events ToolEventBus
oob_registry OOBRegistry
fragment_target_registry FragmentTargetRegistry
sections dict[str, Section]
route_metas dict[str, RouteMeta | None]
route_templates dict[str, str]
discovered_routes list[Any]
page_handler_findings list[PageHandlerFinding]
route_layout_chains dict[str, Any]
swap_scope_map dict[str, str]
layout_presets dict[str, LayoutPreset]
plugin_loaders list[Any]
contract_checks list[Callable[..., Any]]
contract_check_data dict[str, Any]
contract_severity_overrides dict[str, Severity]
freeze_param_providers dict[str, Callable[..., Any]]
freeze_exclude set[str]
live_blocks dict[tuple[str, str], LiveBlockSpec]
mount_app_skips list[MountAppSkip]
consumed_by_mount_app_prefix str | None
RuntimeAppState 14
Compiled runtime state populated during freeze.

Compiled runtime state populated during freeze.

Attributes

Name Type Description
frozen bool
contracts_ready bool
router Router | None
middleware tuple[Callable[..., Any], ...]
kida_env Environment | None
tool_registry ToolRegistry | None
oob_registry OOBRegistry | None
fragment_target_registry FragmentTargetRegistry | None
discovered_routes list[Any]
route_layout_chains dict[str, Any]
swap_scope_map dict[str, str]
routes_by_name Any
route_name_collisions dict[str, list[Route]]
debug_wiring RuntimeDebugWiring
ContractCheckSnapshot 19
Stable read model for contract checks. Third-party contract checks receive this snapshot alongside…

Stable read model for contract checks.

Third-party contract checks receive this snapshot alongside a CheckResult to append issues to. The template_sourcesdict contains{template_name: source_text}for every loaded template, andextrascarries arbitrary data registered via app.set_contract_check_data().

Attributes

Name Type Description
router Router
kida_env Environment | None
layout_chains list[Any]
page_route_paths set[str]
page_leaf_templates set[str]
page_templates set[str]
fragment_target_registry FragmentTargetRegistry
islands_contract_strict bool
oob_registry OOBRegistry | None
sections dict[str, Section]
route_metas dict[str, RouteMeta | None]
route_templates dict[str, str]
discovered_routes list[Any]
page_handler_findings list[PageHandlerFinding]
route_name_collisions dict[str, list[Route]]
mount_app_skips list[MountAppSkip]
debug_wiring RuntimeDebugWiring
template_sources dict[str, str]
extras dict[str, Any]