Module

app.mount

mount_appadapter — hoist a pre-freeze sub-app into a parent app.

Design notes live indocs/rfcs/005-mount-app.md. Summary:

  • Sub-app'spending_routesare path-prefixed and appended to the parent.
  • Middleware, hooks, loaders, tools, and contract checks are appended — parent's entries run first, sub-app's follow.
  • Template globals, filters, error handlers, providers, severity overrides, and freeze-param providers use parent-wins merge; dropped sub-app entries are recorded asMountAppSkips (surfaced later as INFO contract issues in categorymount_app_merge).
  • Sub-app is marked consumed — subsequentsub_app.freeze()/run() raiseRuntimeErrorso the caller doesn't accidentally serve a half-mounted standalone runtime.

Deeper page-shell registries (sections, OOB, fragment targets, layout presets, live blocks, page-discovery state) are not yet supported: mount_app raises ConfigurationErrorif the sub-app has populated any of them. RFC 005 §3.3 treats these as "deep contracts" whose silent override would break shell rendering; a future version may add explicit collision handling.

Functions

normalize_prefix 1 str
Return ``"/" + prefix.strip("/")``. Raises ``ConfigurationError`` if the resul…
def normalize_prefix(prefix: str) -> str

Return"/" + prefix.strip("/").

RaisesConfigurationError if the result would be "/"— mounting at root has no effect vs. registering the routes directly on the parent.

Parameters
Name Type Description
prefix str
Returns
str
prefixed_path 2 str
Return the sub-app route's path after applying the mount prefix. ``prefix`` is…
def prefixed_path(path: str, prefix: str) -> str

Return the sub-app route's path after applying the mount prefix.

prefix is pre-normalized to "/<something>"(see normalize_prefix()); pathis whatever the sub-app registered (expected to start with"/").

Parameters
Name Type Description
path str
prefix str
Returns
str
_check_sub_app_simple 1 None
Refuse sub-apps that carry state mount_app v1 can't hoist safely.
def _check_sub_app_simple(sub_state: MutableAppState) -> None
Parameters
Name Type Description
sub_state MutableAppState
hoist 3 None
Merge ``sub_state`` into ``parent_state`` at ``prefix``. Does not validate tha…
def hoist(parent_state: MutableAppState, sub_state: MutableAppState, prefix: str) -> None

Mergesub_state into parent_state at prefix.

Does not validate that either state is mutable / pre-freeze — the caller (App.mount_app) owns the lifecycle checks.

Parameters
Name Type Description
parent_state MutableAppState
sub_state MutableAppState
prefix str