Piglet: Fast Python Template Engine

Piglet is a templating engine that compiles templates to fast python byte code. Piglet templates look like this:

<py:extends href="base.html">
    <py:block name="content">
        Hello ${name}!
        <ul>
            <li py:for="item in bag">$item</li>
        </ul>
    </py:block>
</py:extends>

Learn more about Piglet’s template directives, or how to use piglet’s Python API.

Piglet also has a text mode:

{% extends "base.txt" %}
    {% block "content" %}
        Hello ${name}!
        {% for item in bag %}
        - $item
        {% end %}
    {% end %}
{% end %}

Indices and tables