--- id: chameleon version: "4.6.0" license: BSD-like (http://repoze.org/license.html) license_treatment: permissive maintenance: active --- # Chameleon — Fast HTML/XML Template Compiler. License: permissive · Maintenance: active · Downloads: 358.2K/mo ## 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 above — 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 pip install chameleon uv add chameleon 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_current - Install friction: low - Maintenance: active - Downloads: 358.2K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags html xml template engine, page template compiler, server-side template rendering, dynamic html generation, template language python, xml template processor, fast template compilation, template-engine, html-xml, compiled-templates [View on SkillFed](https://skillfed.io/packages/chameleon) · [View on PyPI](https://pypi.org/project/chameleon/)