Module

environment.filters._debug

Debug filters for Kida templates.

Functions

_debug_repr 2 str
Create a compact repr for debug output.
def _debug_repr(value: Any, max_len: int = 60) -> str
Parameters
Name Type Description
value Any
max_len int Default:60
Returns
str
_filter_debug 3 Any
Debug filter that prints variable info to stderr and returns the value unchange…
def _filter_debug(value: Any, label: str | None = None, max_items: int = 5) -> Any

Debug filter that prints variable info to stderr and returns the value unchanged.

Usage: {{ posts | debug }} -> Shows type and length {{ posts | debug('my posts') }} -> Shows with custom label {{ posts | debug(max_items=10) }} -> Show more items

Output example: DEBUG [my posts]: <list[5]> [0] Page(title='Getting Started', weight=10) [1] Page(title='Installation', weight=None) <-- None! ...

Parameters
Name Type Description
value Any

The value to inspect

label str | None

Optional label for the output

Default:None
max_items int

Maximum number of items to show for sequences

Default:5
Returns
Any
_filter_pprint 1 str
Pretty-print a value.
def _filter_pprint(value: Any) -> str
Parameters
Name Type Description
value Any
Returns
str