Skip to main content

A fast, strongly typed html templating library for python

Project description

Tempered (Beta)

A modern html templating library for python

Documentation PyPi Github
pip install tempered

Features

  • Fast: Sub-millisecond render times. Roughly 5x faster than jinja, 50x faster than django
  • Scoped and Bundled CSS: CSS is scoped per file and then bundled together into a single stylesheet per page
  • Native Preprocesser Support: Native support for Sass and Typescript
  • Component Based: Each template is a components and can call other components
  • Layouts: Templates can use layouts, based on jinja2's implementation
  • Dyanimcly Typed: Optional dynamic type information can be built with components for better intelisense.
from tempered import Tempered

tempered = Tempered("./templates")
html = tempered.render_template("image.html",
    src="/example.png",
    alt="Example Post",
)
print(html)
<!-- templates/Image.html -->
{% param src: str %}
{% param alt: str = "" %}

<img src="{{src}}" alt="{{alt}}">

<style>
    img {
        width: 100px;
        height: 100px;
    }
</style>
<img alt="Example Post" src="/example.png" class=image-83dc><style>img.image-83dc{width:100px;height:100px}</style>

Transpiled

Templates are transpiled into python functions to provide increased performance.

Full Page Benchmark Partials Benchmark Static Page Benchmark

View Benchmarks Here

Type Hinted

Dynamically created type information allows improved IDE intergration.

Type Hinting.webm

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tempered-0.10.0.tar.gz (32.5 kB view hashes)

Uploaded Source

Built Distribution

tempered-0.10.0-py3-none-any.whl (34.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page