Skip to main content

Tempered Banner

A modern html templating library for python

Test Package version Supported Python versions


Documentation: https://Ben-Brady.github.io/tempered/

Source Code: https://github.com/Ben-Brady/tempered

pip install tempered

Tempered is templating library designed around HTML and type safety.

  • Fast: Sub-millisecond render times.
  • 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
  • Component Based: Each template is a components and can call other components
  • Layouts: Templates can use layouts, based on jinja2's implementation
  • Dynamically Typed: Optional dynamic type information can be built with components for better intelisense.

Lightning Fast

  • Templates are optimised and compiled into Python leading to microsecond long render times.
  • 5x faster than Jinja, 50x faster the django
Full Page Benchmark Partials Benchmark Static Page Benchmark

Native CSS

CSS is scoped per componenet and bundled together into a single stylesheet.

<div>
  <img src="https://picsum.photos/320/180" alt="Example Post">
</div>

<style lang="sass">
  div {
    box-sizing: content-box;
    width: fit-content;
    overflow: hidden;

    border-radius: 1rem;
    border: .15rem solid black;

    img {
      height: auto;
      width: 10rem;
    }
  }
</style>

Example

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>

Metadata

Release files for tempered 0.11.0

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

Source distribution (sdist)

Source distribution for tempered 0.11.0
File Size Uploaded
tempered-0.11.0.tar.gz 41.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for tempered 0.11.0
File Interpreter ABI Platform
tempered-0.11.0-py3-none-any.whl Python 3 none any Details

Total release size: 74.5 kB

Release files / tempered-0.11.0.tar.gz

Download URL tempered-0.11.0.tar.gz
Size 41.7 kB
Tags Source
SHA-256 checksum
How to use checksums
ab6e87fc8c29d1ec414649d68b083f7e4a27af9c476f1ff5295956f0ee5cc24c
BLAKE2b-256 checksum
How to use checksums
e261095cadf2a3f660ef344623e0c4cbb126da3390e04ed4b3c99c8c07fe1362
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.32.3

Release files / tempered-0.11.0-py3-none-any.whl

Download URL tempered-0.11.0-py3-none-any.whl
Size 32.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ec33e8055f4f6b40074790f3727411268ac87825fff3a50f4c00ab2127e556d7
BLAKE2b-256 checksum
How to use checksums
65a8e62a5c4d75be295dd1ee6b6d583c061f237a7289eeea81573047fc175975
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.32.3

Release history Release notifications | RSS feed

This release

0.11.0 This release

2 release files

0.9.2

2 release files

0.9.1

2 release files

0.9.0

2 release files

0.8.2

2 release files

0.8.1

2 release files

0.8.0

2 release files

0.7.9

2 release files

0.7.8

2 release files

0.7.7

2 release files

0.7.6

2 release files

0.7.5

2 release files

0.7.4

2 release files

0.7.3

2 release files

0.7.2

2 release files

0.7.1

2 release files

0.7.0

2 release files

0.6.4

2 release files

0.6.3

2 release files

0.6.2

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.5

2 release files

0.4.4

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.0.2

2 release files

0.0.1

2 release files

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