TemplateStream client-shape contract checks.
TemplateStreamalways renders a whole template file (chunked HTTP). It is
not a fragment return type — pairing it with htmxhx-targetswaps nests a
full document inside a div. Seedocs/hypermedia-footguns.md.
contracts.rules_template_stream
| 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
Return the template path from a literalTemplateStream(...)return.
Map route path → template name for handlers returningTemplateStream.
Yield(url, target_id) for mutating elements with an explicit hx-target.
Warn when htmx swaps aTemplateStreamresponse into a fragment target.
_template_stream_template
function
def _template_stream_template(handler: Any) -> str | None
Return the template path from a literalTemplateStream(...)return.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
handler
|
Any
|
— |
_collect_template_stream_routes
function
def _collect_template_stream_routes(router: Router) -> dict[str, str]
Map route path → template name for handlers returningTemplateStream.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
router
|
Router
|
— |
_iter_htmx_targeted_mutations
function
def _iter_htmx_targeted_mutations(source: str) -> list[tuple[str, str]]
Yield(url, target_id) for mutating elements with an explicit hx-target.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
source
|
str
|
— |
check_template_stream_client_shape
function
def check_template_stream_client_shape(template_sources: dict[str, str], router: Router) -> list[ContractIssue]
Warn when htmx swaps aTemplateStreamresponse into a fragment target.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
template_sources
|
dict[str, str]
|
— | |
router
|
Router
|
— |
View source · /home/runner/work/chirp/chirp/site/../src/chirp/contracts/rules_template_stream.py:1