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 details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

Details for the file tempered-0.10.0.tar.gz.

File metadata

  • Download URL: tempered-0.10.0.tar.gz
  • Upload date:
  • Size: 32.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.28.1

File hashes

Hashes for tempered-0.10.0.tar.gz
Algorithm Hash digest
SHA256 9fafc29df6ccef39112cc33b26df3feaa347dc436d486f625407037592ced614
MD5 0ae519314410920c27f7f63780a03243
BLAKE2b-256 04db5e222434cfd3449b17bed2b73afd0bb99885f50585c81f45895bedfd3cf5

See more details on using hashes here.

File details

Details for the file tempered-0.10.0-py3-none-any.whl.

File metadata

  • Download URL: tempered-0.10.0-py3-none-any.whl
  • Upload date:
  • Size: 34.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.28.1

File hashes

Hashes for tempered-0.10.0-py3-none-any.whl
Algorithm Hash digest
SHA256 46bf1dd867ec00e23863d52ec4f1191fe2d520c498b8840e66764d246b3cde57
MD5 ac19a7b50da0d2cab04ef89a5283a36c
BLAKE2b-256 ba9032f380fba861c664476e5da59707f5214e4f23750e8e0c7f273743f3f8c1

See more details on using hashes here.

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