Genshi
A toolkit for generation of output for the web
What it is and what it does
Genshi is a web templating and markup processing toolkit that combines parsing, generation, and transformation of HTML, XML, and text content. It provides a template language inspired by Kid, allowing developers to embed dynamic logic directly into markup for server-side output generation. The library handles the full pipeline from template definition through rendering to final output format.
The package is designed for web applications that need to generate dynamic HTML or XML content programmatically. It sits between raw string concatenation and heavier frameworks, offering a middle ground with integrated parsing and a domain-specific template syntax. With a single runtime dependency and low install friction, it integrates straightforwardly into existing Python projects.
Use it for:
- Generate dynamic HTML pages from templates with embedded Python logic for web applications.
- Transform and process XML documents by parsing, modifying, and re-rendering them.
- Build email templates that mix markup structure with dynamic content substitution.
- Create configuration or report files in HTML or XML format from Python data structures.
- Parse and validate HTML or XML input, then output sanitized or transformed versions.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Genshi is a Python library for parsing, generating, and processing HTML, XML, and other textual content, with a built-in template language inspired by Kid for web output generation.
Yes, if you need a lightweight, integrated template engine for HTML/XML generation in web projects. The permissive BSD license, low install friction, active maintenance, and zero known vulnerabilities make it a safe choice. However, verify Python version support for your target runtime, as classifiers list both Python 2 and 3 without specifying which versions are actually supported.
Install
genshi on PyPI
pip
pip install genshiuv
uv add genshipoetry
poetry add genshiInstalling Genshi
Before you install
Low install friction with a single runtime dependency (importlib-resources). The package is actively maintained with a recent release and no known vulnerabilities.
License in practice
BSD license is permissive, allowing use in commercial and private projects with minimal restrictions—include a copy of the license in distributions.
Quickstart
pip install genshi
from genshi.markup import MarkupTemplate
tmpl = MarkupTemplate('<div xmlns:py="http://genshi.edgewall.org/"><py:for each="item in items">${item}</py:for></div>')
print(tmpl.generate(items=['a', 'b', 'c']).render('html'))
Verify before relying
- Whether the package supports modern Python versions beyond what classifiers indicate (Python 2 and 3 both listed).
- Current state of the Kid template language inspiration—whether Genshi's syntax remains compatible with or diverges from Kid.
- Whether importlib-resources is required only for older Python versions or unconditionally.
Package facts
| License | BSD (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — importlib-resources |
| Maintenance | actively maintained — 89 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 290,018/month — #7,994 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: genshi-0.7.11-py3-none-any.whl
Keywords: python.templating.engines
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
empyEmPy is a templating system that embeds Python…
permissive · top 15,000 on PyPI
yattagYattag generates HTML or XML documents using…
copyleft · top 5,000 on PyPI
hyperscriptHyperscript lets you generate HTML markup…
permissive · top 15,000 on PyPI
Jinja2Jinja2 is a templating engine that renders…
permissive · top 100 on PyPI
MarkupPyMarkupPy generates HTML and XML markup from…
permissive · top 5,000 on PyPI
BeautifulSoupBeautiful Soup parses HTML and XML documents…
permissive · top 15,000 on PyPI
beautifulsoup4Beautiful Soup parses HTML and XML documents…
permissive · top 100 on PyPI
htmltoolshtmltools provides Python functions to…
permissive · top 5,000 on PyPI
meld3meld3 is an HTML/XML templating system that…
permissive · top 15,000 on PyPI
turbohtmlParse, query, edit, and serialize HTML and XML…
permissive · top 15,000 on PyPI