Module

app.registry

Registration helpers for App setup APIs.

Classes

AppRegistry 19
Owns setup-time registration and page mount wiring.

Owns setup-time registration and page mount wiring.

Methods

route 6 Callable[[Callable[..., …
def route(self, path: str, *, methods: list[str] | None, name: str | None, referenced: bool, template: str | None, inline: bool) -> Callable[[Callable[..., Any]], Callable[..., Any]]
Parameters
Name Type Description
path
methods
name
referenced
template
inline
Returns
Callable[[Callable[..., Any]], Callable[..., Any]]
provide 2
def provide(self, annotation: type, factory: Callable[..., Any]) -> None
Parameters
Name Type Description
annotation
factory
register_domain 1
def register_domain(self, domain: object) -> None
Parameters
Name Type Description
domain
tool 2 Callable[[Callable[..., …
def tool(self, name: str, *, description: str) -> Callable[[Callable[..., Any]], Callable[..., Any]]
Parameters
Name Type Description
name
description
Returns
Callable[[Callable[..., Any]], Callable[..., Any]]
error 1 Callable[[Callable[..., …
def error(self, code_or_exception: int | type[Exception]) -> Callable[[Callable[..., Any]], Callable[..., Any]]
Parameters
Name Type Description
code_or_exception
Returns
Callable[[Callable[..., Any]], Callable[..., Any]]
add_middleware 1
def add_middleware(self, middleware: Any) -> None
Parameters
Name Type Description
middleware
add_reload_dir 1
def add_reload_dir(self, path: str | Path) -> None
Parameters
Name Type Description
path
register_section 1
Register a named section for route metadata resolution.
def register_section(self, section: Section) -> None
Parameters
Name Type Description
section
template_filter 1 Callable[[Callable[..., …
def template_filter(self, name: str | None) -> Callable[[Callable[..., Any]], Callable[..., Any]]
Parameters
Name Type Description
name
Returns
Callable[[Callable[..., Any]], Callable[..., Any]]
template_global 1 Callable[[Callable[..., …
def template_global(self, name: str | None) -> Callable[[Callable[..., Any]], Callable[..., Any]]
Parameters
Name Type Description
name
Returns
Callable[[Callable[..., Any]], Callable[..., Any]]
on_startup 1 Callable[..., Any]
def on_startup(self, func: Callable[..., Any]) -> Callable[..., Any]
Parameters
Name Type Description
func
Returns
Callable[..., Any]
on_shutdown 1 Callable[..., Any]
def on_shutdown(self, func: Callable[..., Any]) -> Callable[..., Any]
Parameters
Name Type Description
func
Returns
Callable[..., Any]
on_worker_startup 1 Callable[..., Any]
def on_worker_startup(self, func: Callable[..., Any]) -> Callable[..., Any]
Parameters
Name Type Description
func
Returns
Callable[..., Any]
on_worker_shutdown 1 Callable[..., Any]
def on_worker_shutdown(self, func: Callable[..., Any]) -> Callable[..., Any]
Parameters
Name Type Description
func
Returns
Callable[..., Any]
add_loader 1
Add a template loader (e.g., from a plugin).
def add_loader(self, loader: Any) -> None
Parameters
Name Type Description
loader
mount_pages 2
def mount_pages(self, pages_dir: str | None, *, lazy_pages: bool) -> None
Parameters
Name Type Description
pages_dir
lazy_pages
discover_and_register_pages 1
def discover_and_register_pages(self, pages_dir: str) -> None
Parameters
Name Type Description
pages_dir
register_page_handler 12
def register_page_handler(self, *, url_path: str, handler: Callable[..., Any], methods: list[str], layout_chain: Any, context_providers: tuple[Any, ...], template_name: str | None = None, meta: Any = None, meta_provider: Any = None, actions: tuple[Any, ...] = (), viewmodel_provider: Any = None, kind: str = 'page', name: str | None = None) -> None
Parameters
Name Type Description
url_path
handler
methods
layout_chain
context_providers
template_name Default:None
meta Default:None
meta_provider Default:None
actions Default:()
viewmodel_provider Default:None
kind Default:'page'
name Default:None
Internal Methods 1
__init__ 2
def __init__(self, state: MutableAppState, ensure_mutable: Callable[[], None]) -> None
Parameters
Name Type Description
state
ensure_mutable