Skip to main content

Spitfire

PyPI version

Introduction

Spitfire is a high-performance Python template language inspired by Cheetah. It originally started out as an experiment to see if techniques used in compilers were applicable to templates. Spitfire has been the primary template language for youtube.com since 2008 and is used to generate billions of views a day.

This particular fork is made so that Spitfire can work with Python 3.

Example

<html>
<head><title>$title</title></head>
<body>
  <ul>
    #for $user in $users
      <li><a href="$user.url">$user.name</a></li>
    #end for
  </ul>
</body>
</html>

Getting Started

Spitfire's syntax is extremely similar to Cheetah, however some directives and language features have been omitted. If you're already using Cheetah, simple templates will likely compile in Spitfire, and there are a couple compatibility modes to ease transition.

Performance

Spitfire has a basic optimizer that can make certain operations much faster. Using a basic 10x1000 table generation benchmark, Spitfire can be faster than other template systems and compares very favorably to hand-coded Python (the upper limit of performance achievable by compiling to Python bytecode). This is by no means exhaustive proof that Spitfire is always fast, just that it can provide very high performance.

# Python 3.10.9 (main, Dec 19 2022, 17:35:49) [GCC 12.2.0] on linux
$ python tests/benchmarks/render_benchmark.py
Running benchmarks 1000 times each...

Genshi tag builder                            646.05 ms
Genshi template                               226.59 ms
Genshi template + tag builder                 448.92 ms
Mako Template                                  58.38 ms
Spitfire template                              33.79 ms
Spitfire template -O1                          20.66 ms
Spitfire template -O2                          12.94 ms
Spitfire template -O3                           8.19 ms
StringIO                                        7.95 ms
cStringIO                                       9.73 ms
list concat                                     7.32 ms
Jinja2 templates                               15.84 ms

Metadata

Release files for spitfire3 0.2.8

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

Source distribution (sdist)

Source distribution for spitfire3 0.2.8
File Size Uploaded Provenance
spitfire3-0.2.8.tar.gz 696.6 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for spitfire3 0.2.8
File Interpreter ABI Platform
spitfire3-0.2.8-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 875.5 kB

Release files / spitfire3-0.2.8.tar.gz

Download URL spitfire3-0.2.8.tar.gz
Size 696.6 kB
Tags Source
SHA-256 checksum
How to use checksums
2cf43e54843b22cda2eef2af70c04e1a6271d9562217d4378934a61ab8da97f7
BLAKE2b-256 checksum
How to use checksums
1453d62d49d41280d2847afa0e5b4af0b806de538330f4172fe090cbf821fe22
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.32.3

Release files / spitfire3-0.2.8-py2.py3-none-any.whl

Download URL spitfire3-0.2.8-py2.py3-none-any.whl
Size 179.0 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
ff8c56712a8cb66a1eb4c8fa0871b0463ef4dbf6ddfff313234da13a641974a6
BLAKE2b-256 checksum
How to use checksums
1b59e97a0ae62925414c89e152a3398cc1fdc5a4c4525ca842aed01cb368bd7b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.32.3

Security for spitfire3 0.2.8

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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