Jinja-based texts and objects render.
pip install jonja
- Make template
hello.j2
Hello, {{ username }}!
*#!#*
world:
$cls: "types:SimpleNamespace"
$kwargs: {name: earth, size: {{ world_size }} }
- Make env
from pathlib import Path
from jonja import JonjaEnv
env = JonjaEnv(Path.cwd() / "static" / "templates")
- Render
text, objs = await env.render("hello", username="mikk", world_size=10_000)