app.compiler

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

Compilation pipeline from mutable setup state to runtime state.

Compilation pipeline from mutable setup state to runtime state.

app.compiler

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

_collect_builtin_middleware
function
def _collect_builtin_middleware(config: AppConfig, middleware_list: list, *, router: object | None = None, oob_registry: OOBRegistry | None = None, debug_wiring: RuntimeDebugWiring | None = None, htmx_manifest: HtmxProvisioningManifest | None = None) -> list

Append builtin middleware (static, safe_target, sse_lifecycle, etc.) to list.

Parameters

Name Type Default Description
config AppConfig —
middleware_list list —
router object | None None
oob_registry OOBRegistry | None None
debug_wiring RuntimeDebugWiring | None None
htmx_manifest HtmxProvisioningManifest | None None
_compile_routes
function
def _compile_routes(pending_routes: list, providers: dict[type, Callable[..., Any]] | None) -> Router

Build router from pending routes.

Parameters

Name Type Default Description
pending_routes list —
providers dict[type, Callable[..., Any]] | None —
_reject_reserved_prefix_collisions
function
def _reject_reserved_prefix_collisions(pending_routes: list, prefix: str) -> None

Raise if any pending route starts with a framework-reserved URL prefix.

The block-fetch dispatcher owns/_frag/**— a user route like /_frag/customwould either shadow the dispatcher or be shadowed by it, and there's no policy where that ambiguity is a good idea. Fail fast with a message that points the user at what to change.

Parameters

Name Type Default Description
pending_routes list —
prefix str —
_reject_internal_route_collisions
function
def _reject_internal_route_collisions(pending_routes: list, debug_wiring: RuntimeDebugWiring) -> None

Raise if a user route collides with Chirp-owned internal URL space.

Parameters

Name Type Default Description
pending_routes list —
debug_wiring RuntimeDebugWiring —
_resolve_session_cookie_secure
function
_validate_middleware_ordering
function
def _validate_middleware_ordering(middleware_list: list) -> None

Check that middleware dependencies are satisfied.

CSRFMiddleware requires SessionMiddleware to wrap it (i.e. Session must be registered before CSRF in add_middleware calls). Detects the mis-ordering early at freeze time rather than waiting for a request to fail.

Parameters

Name Type Default Description
middleware_list list —
AppCompiler
class

Compiles app setup state into immutable runtime state.

View source · /home/runner/work/chirp/chirp/site/../src/chirp/app/compiler.py:1