skillfed

Cheetah3

Cheetah is a template engine and code generation tool

cheetah3 v3.2.6.post1 405.8K downloads/30d#6,900 on PyPI148
Permissive license MIT Active released

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 cheetah3

uv

uv add cheetah3

poetry

poetry add cheetah3

Installing 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

Development Status :: 5 - Production/StableIntended Audience :: DevelopersIntended Audience :: System AdministratorsLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 2Programming Language :: Python :: 2.7Programming Language :: Python :: 3Programming Language :: Python :: 3.4Programming Language :: Python :: 3.5Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: Internet :: WWW/HTTPTopic :: Internet :: WWW/HTTP :: Dynamic ContentTopic :: Internet :: WWW/HTTP :: Site ManagementTopic :: Software Development :: Code GeneratorsTopic :: Software Development :: Libraries :: Python ModulesTopic :: Software Development :: User InterfacesTopic :: Text Processing

Tags

template engine pythoncode generation tooldynamic content renderingtemplate languagetext generation frameworkhtml template processorcheetah templating
template-enginecode-generationno-dependencies

More Python Modules packages