Skip to main content

Piglet Template Engine

piglet-templates is a text and HTML templating engine in the genshi/kajiki templates family.

The Piglet template engine offers:

  • Template inhertitance through <py:extends>/<py:block> (similar to Jinja2)

  • Compiles templates to fast python byte code.

  • HTML templating: templates produce well formed HTML. Template variables are autoescaped to protect against XSS attacks.

  • Reusable template functions.

  • Good i18n support.

  • Clear tracebacks from exceptions raised in templates.

Piglet Template Engine Documentation | Repository

Example piglet template:

<py:extends href="layout.html">
    <py:block name="content">
        <h1>This is the content block.</h1>
        <p>
            Hello $user.firstnames $user.lastname!
        </p>
        <p py:for="verse in poem">
            <py:for each="line in verse">$line<br/></py:for>
        </p>
    </py:block>
</py:extends>

There’s a text templating mode too:

Hello $user.firstnames $user.lastname!

{% for verse in poem %}
    {% for line in verse %}$line
    {% end %}
{% end %}

License

Piglet-templates is licensed under the Apache license version 2.0.

Piglet-templates is developed by Olly Cope and was created for skot.be

Metadata

Release files for piglet-templates 1.3.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for piglet-templates 1.3.3
File Size Uploaded
piglet_templates-1.3.3.tar.gz 51.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for piglet-templates 1.3.3
File Interpreter ABI Platform
piglet_templates-1.3.3-py3-none-any.whl Python 3 none any Details

Total release size: 119.3 kB

Release files / piglet_templates-1.3.3.tar.gz

Download URL piglet_templates-1.3.3.tar.gz
Size 51.9 kB
Tags Source
SHA-256 checksum
How to use checksums
2efbc65ab91024fe96ebfc93cdfe0772e9f72004bcee9cd34aef82a47d64867c
BLAKE2b-256 checksum
How to use checksums
c7c974b012f7338f8c3a368da93bb4f710783042f8e75598c7def66dd5080fd9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.14

Release files / piglet_templates-1.3.3-py3-none-any.whl

Download URL piglet_templates-1.3.3-py3-none-any.whl
Size 67.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cd583bd398d52057ffd87f31c2ee29aef9042a72c44e1405c41a305a74f6f6dc
BLAKE2b-256 checksum
How to use checksums
c48f6cc4216f8a6870c5555b2617214304b82a2617048e27575dc987607f20af
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.14
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page