Fastest dependency-free, typed Mustache renderer for Python 3.12+
Project description
Fstache
Overview
- Dependency-free Mustache renderer for Python 3.12+.
- Supports upstream Mustache spec fixtures, including lambdas and dynamic partial names; inheritance is unsupported.
- Built for speed; benchmarked at 3.3x Chevron, 3.1x mstache, and 3.5x Pystache.
- PEP 561 typed package.
- Supports Python mappings, objects, sequences, and callables as render data.
- Static partials are preloaded and inlined, eliminating render-time boundary overhead.
Benchmarks
Renderer Throughput
| Library | Renders per second | Indentation details |
|---|---|---|
| Fstache | 4066.5 | Deviates: ignore_indents=True skips standard standalone partial reindentation. |
| Fstache | 3102.2 | Follows standard standalone partial indentation. |
| mstache | 1339.0 | Deviates: keep_lines=True keeps tag-only lines instead of collapsing them, so partial indentation is not reapplied to every partial line. |
| mstache | 985.3 | Follows standard standalone partial indentation. |
| Chevron | 951.1 | Follows standard standalone partial indentation. |
| Pystache | 898.8 | Follows standard standalone partial indentation. |
Benchmark environment
| Field | Value |
|---|---|
| Python | CPython 3.14.6 |
| OS | Fedora Linux 44 (Workstation Edition), Linux 7.0.12-201.fc44.x86_64 |
| CPU | AMD Ryzen 7 8845HS w/ Radeon 780M Graphics, 8 cores / 16 threads |
| Compared versions | Fstache 0.1.0, Chevron 0.14.0, mstache 0.3.0, Pystache 0.6.8 |
| Command | RENDERER=<renderer> uv run --python 3.14 --extra dev python tests/perf_test.py<renderer> values: fstache.no_indentation, fstache, mstache.no_indentation, mstache, chevron, pystache |
Methodology
- The benchmark renders a realistic, heavy marketing/docs HTML page from the
source Mustache templates, JSON data, and
perf script:
- About 100 KiB of rendered HTML (source) from 15 Mustache templates, including 14 partial files.
- Tailwind CSS v4 utility-heavy markup with Alpine.js attributes, inline SVG icons, responsive navigation, cards, tables, accordions, and form controls.
- About 15 KiB of JSON context data with nested arrays for navigation, feature cards, testimonials, a recursive docs tree, comparison rows, blog posts, changelog entries, FAQs, and pricing plans.
- 42 section, inverted-section, and partial references, including 24 section
tags for loops and conditionals plus recursive
nodepartial rendering.
- The benchmark isolates render throughput from setup work:
- Each engine preloads the template files and partials during setup.
- Each engine uses the closest available precompiled, preparsed, or pretokenized representation for the layout and partials.
- The timed render loop excludes disk I/O and one-time template preparation.
Utility Commands
Generate Reference HTML
Builds and renders the templates from ./demo into ./demo/dist/index.html (performing file I/O):
make build-html
Format and Lint
Runs ruff checks and auto-formats the project:
make post-ai-change
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
fstache-0.1.1.tar.gz
(16.5 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
fstache-0.1.1-py3-none-any.whl
(19.5 kB
view details)
File details
Details for the file fstache-0.1.1.tar.gz.
File metadata
- Download URL: fstache-0.1.1.tar.gz
- Upload date:
- Size: 16.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.25 {"installer":{"name":"uv","version":"0.11.25","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6db4deed7bfc424b1f4a019e93c2d10e89e4a6bfe49eb217ac9acabdf91fda9e
|
|
| MD5 |
96e3cff990cd8739443cbb8aadc683c1
|
|
| BLAKE2b-256 |
1863a557b69773470ef6e7d9118693f4579a94976ce6d4ecaae3289c9ad9fb4f
|
File details
Details for the file fstache-0.1.1-py3-none-any.whl.
File metadata
- Download URL: fstache-0.1.1-py3-none-any.whl
- Upload date:
- Size: 19.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.25 {"installer":{"name":"uv","version":"0.11.25","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
585fdecbed4bbc079bf7d0ed952910d71e5e49dd5644912c6a8df5c7024db012
|
|
| MD5 |
c2020aa941775f24c220bf802bd05123
|
|
| BLAKE2b-256 |
ae9daa454180b70a98336aaed7b762284f5065ec02b50112361e3df3c32ff473
|