Cheetah3
Cheetah is a template engine and code generation tool
What it is and what it does
Cheetah3 is a template engine that reads template files containing directives and variable placeholders, then generates output in any text-based format—HTML, code, configuration files, or plain text. It compiles templates into Python code for execution, making it suitable for both web frameworks and standalone code generation tasks. The package has no runtime dependencies and works across Python 2.7 and Python 3.4+, supporting both CPython and PyPy.
Typical workflows involve writing a template with Cheetah syntax (variable substitution, conditionals, loops, function definitions), instantiating a Template object, and rendering it to a string. It's commonly used in web development to generate dynamic HTML, but also serves as a general-purpose code generator for C++, Java, SQL, and other languages. The fork maintains compatibility with the original CheetahTemplate library while adding support for modern Python versions.
Use it for:
- Generate dynamic HTML pages in web applications by embedding Cheetah templates in a framework.
- Produce boilerplate code (C++, Java, Python) from template definitions during build or scaffolding steps.
- Create form emails and notification templates with dynamic content substitution.
- Generate SQL queries or configuration files from parameterized templates.
- Standalone code generation tool for domain-specific languages or custom DSLs.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Cheetah3 is a template engine and code generator that transforms template files into Python, HTML, C++, Java, SQL, and other output formats.
Yes, if you need a mature, dependency-free template engine with broad language support. Cheetah3 is stable, permissively licensed, and actively maintained. Install with caution if targeting Python versions beyond 3.8, as the latest release (2021-02-22) predates recent Python versions; verify compatibility for your specific version before committing to production use.
Install
cheetah3 on PyPI
pip
pip install cheetah3uv
uv add cheetah3poetry
poetry add cheetah3Installing Cheetah3
Before you install
Medium install friction due to compiled wheels for multiple Python versions (2.7 through 3.8). Package is actively maintained with a recent commit on 2026-08-08, though the latest release was 2021-02-22, suggesting stable but infrequent updates.
License in practice
MIT license is permissive, allowing commercial and private use with minimal restrictions. You may use, modify, and distribute Cheetah3 freely as long as you include the license notice.
Quickstart
pip install Cheetah3
from Cheetah.Template import Template
template_text = '#def greet(name)\nHello $name!\n#end def\n$greet("World")'
t = Template(template_text)
print(t)
Requires Python 2.7 or Python 3.4+ (not 3.0–3.3). Pre-built wheels are available for common platforms, but source installation may require a C compiler.
Verify before relying
- Whether the package is actively developed or in maintenance-only mode given the gap between last release (2021-02-22) and current date.
- Performance characteristics and typical use-case scale (e.g., template compilation speed, output size limits).
- Compatibility with modern Python versions beyond 3.8 (classifiers list 3.9 but latest release predates widespread 3.9 adoption).
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*) |
| Install friction | medium — platform-specific wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 1,999 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 405,812/month — #6,900 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: Cheetah3-3.2.6.post1-cp27-cp27m-macosx_10_13_x86_64.whl; Cheetah3-3.2.6.post1-cp27-cp27mu-manylinux1_x86_64.whl; Cheetah3-3.2.6.post1-cp27-cp27m-win32.whl; Cheetah3-3.2.6.post1-cp27-cp27m-win_amd64.whl; Cheetah3-3.2.6.post1-cp35-cp35m-macosx_10_6_x86_64.whl; Cheetah3-3.2.6.post1-cp35-cp35m-manylinux1_x86_64.whl; Cheetah3-3.2.6.post1-cp35-cp35m-win32.whl; Cheetah3-3.2.6.post1-cp35-cp35m-win_amd64.whl; Cheetah3-3.2.6.post1-cp36-cp36m-macosx_10_9_x86_64.whl; Cheetah3-3.2.6.post1-cp36-cp36m-manylinux1_x86_64.whl; Cheetah3-3.2.6.post1-cp36-cp36m-win32.whl; Cheetah3-3.2.6.post1-cp36-cp36m-win_amd64.whl; Cheetah3-3.2.6.post1-cp37-cp37m-macosx_10_9_x86_64.whl; Cheetah3-3.2.6.post1-cp37-cp37m-manylinux1_x86_64.whl; Cheetah3-3.2.6.post1-cp37-cp37m-win32.whl; Cheetah3-3.2.6.post1-cp37-cp37m-win_amd64.whl; Cheetah3-3.2.6.post1-cp38-cp38-macosx_10_9_x86_64.whl; Cheetah3-3.2.6.post1-cp38-cp38-manylinux1_x86_64.whl; Cheetah3-3.2.6.post1-cp38-cp38-win32.whl; Cheetah3-3.2.6.post1-cp38-cp38-win_amd64.whl
Keywords: template
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
ct3Cheetah3 is a template engine and code…
permissive · top 5,000 on PyPI
licenseheadersBatch-updates or adds license headers to source…
permissive · top 15,000 on PyPI
MakoMako compiles Python-embedded templates into…
permissive · top 1,000 on PyPI
TempitaTempita is a lightweight templating engine that…
permissive · top 15,000 on PyPI
html5taggerGenerates HTML5 markup programmatically using…
permissive · top 5,000 on PyPI
cogappCog executes Python code snippets embedded in…
permissive · top 15,000 on PyPI
Panda3DPanda3D is a 3D game engine with Python…
permissive · top 15,000 on PyPI
htmlBuilderRender HTML by writing Python code, using…
permissive · top 15,000 on PyPI
SphinxSphinx generates professional documentation…
permissive · top 1,000 on PyPI
Jinja2Jinja2 is a templating engine that renders…
permissive · top 100 on PyPI