django-templates-cythonized
Cython-accelerated drop-in replacement for Django's template engine. 3-14x faster depending on template complexity.
This is a benchmarking tool to evaluate what a Cython-level template speedup would bring to your project. Not meant for production use. Feel free to try though — if you run into issues, open an issue and I'll see if I can help.
Benchmarks
Measured on an AMD Ryzen 9 5950X, Python 3.14t (free-threaded).
| Benchmark | Cythonized | Stock Django | Speedup |
|---|---|---|---|
| 1000-book table (for/if/cycle/filters) | 2.4 ms | 33.7 ms | 14x |
| 50-book table + per-book forms (4 widgets/row) | 6.1 ms | 21.3 ms | 3.5x |
Usage
TEMPLATES = [
{
"BACKEND": "django_templates_cythonized.backend.CythonizedTemplates",
"DIRS": [BASE_DIR / "templates"],
"APP_DIRS": True,
"OPTIONS": {
"context_processors": [
"django.template.context_processors.debug",
"django.template.context_processors.request",
"django.contrib.auth.context_processors.auth",
"django.contrib.messages.context_processors.messages",
],
},
}
]
For form-heavy templates, also set the form renderer:
FORM_RENDERER = "django_templates_cythonized.backend.CythonizedFormRenderer"
Development
git clone https://github.com/oliverhaas/django-templates-cythonized.git
cd django-templates-cythonized
uv sync --group dev
uv pip install -e . # Build Cython extensions
uv run pytest # Run tests
uv run pytest tests/benchmarks/ -v --no-cov -p no:codspeed # Run benchmarks
Re-run uv pip install -e . after modifying .py files to recompile.
Attribution & License
Contains modified copies of Django's template source code. BSD-3-Clause (matching Django). Benchmark structure inspired by django-rusty-templates.
Metadata
Release files for django-templates-cythonized 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| django_templates_cythonized-0.1.0.tar.gz | 2.4 MB | Details |
Built distributions (wheels)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_templates_cythonized-0.1.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl | CPython 3.14 | CPython 3.14 | Linux glibc 2.17+ x86-64, Linux glibc 2.28+ x86-64 | Details |
| django_templates_cythonized-0.1.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl | CPython 3.13 | CPython 3.13 | Linux glibc 2.17+ x86-64, Linux glibc 2.28+ x86-64 | Details |
| django_templates_cythonized-0.1.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl | CPython 3.12 | CPython 3.12 | Linux glibc 2.17+ x86-64, Linux glibc 2.28+ x86-64 | Details |
Total release size: 35.9 MB
Release files / django_templates_cythonized-0.1.0.tar.gz
| Download URL | django_templates_cythonized-0.1.0.tar.gz |
|---|---|
| Size | 2.4 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9f2b2e985edc17296644c2550294d95fad0be573c21a227547b4b143cf1d3b8b
|
|
BLAKE2b-256 checksum How to use checksums |
ed25abed71349f018e521ab1161bcefa97fcbd88a8dab3e537a02b40c226fcf6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 8, 2026.
Transparency logRelease files / django_templates_cythonized-0.1.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
| Download URL | django_templates_cythonized-0.1.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 11.0 MB |
| Tags | CPython 3.14 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
be97d41b5a5a040697924a19661812ed0ef437e0f219cde2d3394a2494ef2a0f
|
|
BLAKE2b-256 checksum How to use checksums |
69fa908f3b7e73b12123b2ed4084cc4ff4773e3ef418da8cac54910b0b1b5eb7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 8, 2026.
Transparency logRelease files / django_templates_cythonized-0.1.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
| Download URL | django_templates_cythonized-0.1.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 11.2 MB |
| Tags | CPython 3.13 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
20c03aba534afaff36b1b76ffc68d9c79e04f2b9f60b5de52a02208b994bfb8c
|
|
BLAKE2b-256 checksum How to use checksums |
248980a74477990943d3bb31fb8fe9afecd3662ca97bef0333805828507f487e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 8, 2026.
Transparency logRelease files / django_templates_cythonized-0.1.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
| Download URL | django_templates_cythonized-0.1.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 11.3 MB |
| Tags | CPython 3.12 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
0472232f17651be3bffaaf14be946e3255596ca3973cc8c9e1cc4f7810182e4f
|
|
BLAKE2b-256 checksum How to use checksums |
01d6d78b33d21eac18b475df5b17823d5cd91f6e0e5a1b558594a8a574e9d8f9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 8, 2026.
Transparency log