Chameleon
Fast HTML/XML Template Compiler.
What it is and what it does
Chameleon is a template engine that compiles HTML and XML templates written in the page templates language into optimized Python code. It runs on Python 3.9 and later, including PyPy, and is designed to be embedded in any Python application without external dependencies. The engine parses template markup and generates bytecode-compiled Python functions, making rendering fast and suitable for high-throughput web applications.
The package handles both HTML and XML modes, supports dynamic content interpolation, conditional rendering, looping, variable scoping, and internationalization. Recent versions have focused on startup-time optimization, Python 3.13 compatibility, and removal of slower legacy dependencies in favor of importlib.resources. It is production-stable and has been maintained since 2009.
Use it for:
- Render dynamic HTML pages in web frameworks by compiling template files into callable Python functions.
- Generate XML documents or feeds from template definitions with variable substitution and conditional blocks.
- Build server-side templated responses in REST APIs where template compilation overhead should be minimized.
- Internationalize web content by leveraging built-in i18n support for translation context and target language handling.
- Embed templating in Python applications that need fast, compiled template execution without external runtime dependencies.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Chameleon is an HTML/XML template engine that compiles page templates into Python code for fast server-side rendering.
Yes. Chameleon is a mature, actively maintained template engine with zero runtime dependencies, permissive licensing, and broad Python version support (3.9 and up, plus PyPy 3). It is well-suited for projects requiring compiled, high-performance HTML/XML templating. Install it if you need a self-contained template solution; avoid it only if your project already standardizes on a different templating approach.
Install
chameleon on PyPI
pip
pip install chameleonuv
uv add chameleonpoetry
poetry add chameleonInstalling Chameleon
Before you install
Low friction installation with no runtime dependencies. The project is actively maintained with recent releases addressing Python 3.13 compatibility and performance improvements.
License in practice
Licensed under a permissive BSD-like license, allowing use in both open-source and proprietary projects with minimal restrictions.
Quickstart
pip install Chameleon
from chameleon import PageTemplateLoader
loader = PageTemplateLoader('templates', auto_reload=True)
template = loader['mytemplate.pt']
output = template(name='World')
Requires Python 3.9 or later; PyPy 3 is also supported.
Verify before relying
- Whether the package includes built-in support for macros, slots, or inheritance beyond what the description excerpt covers.
- Performance characteristics compared to other template engines in typical web application scenarios.
- Whether the i18n/translation features mentioned in the changelog are production-ready or experimental.
Package facts
| License | BSD-like (http://repoze.org/license.html) (permissive) |
| Python support | supports the current Python release (>=3.9) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 591 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 358,222/month — #7,264 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: Chameleon-4.6.0-py3-none-any.whl
Tags
More Dynamic Content packages
MarkupSafe provides a text object that escapes…
permissive · top 100 on PyPI
Jinja2Jinja2 is a templating engine that renders…
permissive · top 100 on PyPI
soupsieveSoupsieve is a CSS selector library designed to…
permissive · top 100 on PyPI
WerkzeugWerkzeug is a WSGI utility library providing…
permissive · top 1,000 on PyPI
FlaskFlask is a lightweight WSGI web application…
permissive · top 1,000 on PyPI
MakoMako compiles Python-embedded templates into…
permissive · top 1,000 on PyPI
z3c.ptz3c.pt is a fast ZPT (Zope Page Template)…
unclear · top 15,000 on PyPI
zope.pagetemplatezope.pagetemplate provides a templating system…
unclear · top 15,000 on PyPI
jinja-cliA command-line tool that renders Jinja2…
copyleft · top 15,000 on PyPI
zope.talzope.tal implements the Template Attribute…
unclear · top 15,000 on PyPI
zope.taleszope.tales provides an expression language for…
unclear · top 15,000 on PyPI
meld3meld3 is an HTML/XML templating system that…
permissive · top 15,000 on PyPI
html5taggerGenerates HTML5 markup programmatically using…
permissive · top 5,000 on PyPI
jinja_partialsAdds a `render_partial()` function to Jinja2…
permissive · top 5,000 on PyPI
yattagYattag generates HTML or XML documents using…
copyleft · top 5,000 on PyPI