Skip to main content
function Template.handlebars
def Template.handlebars(
template: str,
/,
*,
data: dict[str, typing.Any] = 
) -> str
Renders a Handlebars template with the provided data. Parameters
  • template: The Handlebars template string.
  • data: A dictionary of data to render the template with.
Returns The rendered template as a string. Example
function Template.jinja2
def Template.jinja2(
template: str,
/,
*,
data: dict[str, typing.Any] = 
) -> str
Renders a Jinja2 template with the provided data. Parameters
  • template: The Jinja2 template string.
  • data: A dictionary of data to render the template with.
Returns The rendered template as a string. Example
function Template.liquid
def Template.liquid(
template: str,
/,
*,
data: dict[str, typing.Any] = 
) -> str
Renders a Liquid template with the provided data. Parameters
  • template: The Liquid template string.
  • data: A dictionary of data to render the template with.
Returns The rendered template as a string. Example
function Template.try_handlebars
def Template.try_handlebars(
template: str,
/,
*,
data: dict[str, typing.Any] = 
) -> typing.Any
Renders a Handlebars template like handlebars, but never fails the evaluation — see try_jinja2 for the (ok, text) contract and when to prefer this over the raising variant. function Template.try_jinja2
def Template.try_jinja2(
template: str,
/,
*,
data: dict[str, typing.Any] = 
) -> typing.Any
Renders a Jinja2 template like jinja2, but never fails the evaluation: a render error is returned to the caller as a value instead of propagating and aborting the whole invocation. Returns a 2-tuple (ok, text):
  • (True, rendered) on success.
  • (False, error_message) on any parse/render error.
Callers use this where a template bug in one surface must degrade to a fallback body rather than crash the process (e.g. status-check renderers). Prefer jinja2 for internal templates whose failure is a programming error that should surface loudly. Example
function Template.try_liquid
def Template.try_liquid(
template: str,
/,
*,
data: dict[str, typing.Any] = 
) -> typing.Any
Renders a Liquid template like liquid, but never fails the evaluation — see try_jinja2 for the (ok, text) contract and when to prefer this over the raising variant.