<% async for blank_page in sketchbook %> <% let sketch = await blank_page.draw() %> <% end %>
Sketchbook is a templating engine designed for asyncio. It takes advantage of
Python 3’s unicode and
await syntax(PEP 492)
asyncio (PEP 3156) and concurrent I/O
with a syntax inspired by ERB and
- Simple Syntax: The syntax of Sketchbook is easy to learn. It mixes the Python syntax with the ERB style tag marker.
- Safe: The output is escaped by default unless manually overridden.
- Unicode Support: Unicode is used by default. No need to worry about Python2 bytestring.
awaitready: Sketchbook is designed to use with
awaitsyntax. Developer can use
awaitsyntax to the full extent.
- Fast Execution: Just like Mako and Jinja2, Sketchbook compiles sketches into Python bytecode before execution, allowing it to be executed as fast as other Python code.
- Dynamic Template Inheritance and Inclusion: Sketches can inherit from and include the other sketches at the runtime, which significantly improve the reusability and flexibility.
$ pip install -U sketchbook
Alternative Event Loop¶
asyncio module from the Python standard library, Sketchbook
can also be used with curio.
There are quite a few template engines for Python, why reinvent the wheel?
- Most template engines are relics from
Python 2.xhence they suck when dealing with unicode.
- Coroutine is now one of a first class feature in the Python language, but not in these template engines.
- None of them support the new type hints system introduced in
- It’s fun!
- Integrate sketchbook into your projects
- The Sketch Templating Language
- API Reference