skillfed

Chameleon

Fast HTML/XML Template Compiler.

chameleon v4.6.0 358.2K downloads/30d#7,264 on PyPI185
Permissive license BSD-like (http://repoze.org/license.html) Active released

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 chameleon

uv

uv add chameleon

poetry

poetry add chameleon

Installing 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

Development Status :: 5 - Production/StableIntended Audience :: DevelopersProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPy

Tags

html xml template enginepage template compilerserver-side template renderingdynamic html generationtemplate language pythonxml template processorfast template compilation
template-enginehtml-xmlcompiled-templates

More Dynamic Content packages