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 Provenance Actions
tempered-0.11.0.tar.gz 41.7 kB Without provenance Details for tempered-0.11.0.tar.gz

Built distribution (wheel)

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

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

Security for tempered 0.11.0

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.

Release history Release notifications | RSS feed

This release

0.11.0 This release

2 release files No provenance

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