Python-first composition vocabulary for shell/content assembly.
ViewRef, RegionUpdate, and PageComposition replace block_name/page_block_name mental overhead with explicit role-based fields. Routes return these objects; the render-plan layer decides what to render based on request headers.
templating.composition
| 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
Reference to a template block with context.
Used for both main content and region updates (shell actions, badges, breadcrumbs, etc.).
Out-of-band update for a persistent shell region.
Renders a ViewRef and delivers it as hx-swap-oob to the named region (DOM element ID). Mode defaults…
Explicit page composition with fragment, page block, and regions.
Replaces Page/LayoutPage block_name/page_block_name with:
- fragment_block: narrow block for non-boosted fragment requests. When None, resolved from…
ViewRef
class
Reference to a template block with context.
Used for both main content and region updates (shell actions, badges, breadcrumbs, etc.).
RegionUpdate
class
Out-of-band update for a persistent shell region.
Renders a ViewRef and delivers it as hx-swap-oob to the named region (DOM element ID). Mode defaults to "oob".
PageComposition
class
Explicit page composition with fragment, page block, and regions.
Replaces Page/LayoutPage block_name/page_block_name with:
- fragment_block: narrow block for non-boosted fragment requests. When None, resolved from FragmentTargetRegistry via HX-Target.
- page_block: wider root for boosted navigation (or full page)
- regions: shell actions, badges, and other persistent-region refreshes
Usage::
PageComposition(
template="skills/page.html",
fragment_block="page_content",
page_block="page_root",
context={"skills": skills},
regions=(
RegionUpdate(
region="shell_actions",
view=ViewRef(
template="chirp/shell_actions.html",
block="content",
context={"shell_actions": actions},
),
),
),
)
View source · /home/runner/work/chirp/chirp/site/../src/chirp/templating/composition.py:1