htbuilder
A purely-functional HTML builder for Python. Think JSX rather than templates.
Decision gist · record as of 2026-08-14
Yes, if you prefer writing HTML in Python and don't need frequent updates. The package is stable, has no security vulnerabilities, and solves a real problem for developers who dislike template syntax. The dormant maintenance and source-only distribution are minor friction, but the zero runtime dependencies and permissive license make it low-risk for projects that can tolerate infrequent upstream changes.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.7 or later.
- Installation friction is high—the package ships as a source distribution only.
- Maintenance is dormant: the last commit was 2025-01-09, but the prior release cycle was 582 days earlier, suggesting infrequent updates.
License · maintenance · safety
Apache 2 (permissive) — Licensed under Apache 2 (permissive), which allows commercial and private use with minimal restrictions. No notable licensing constraints for most use cases.
last release 2025-01-09 (582 days) · last repo commit 2025-01-09 · 104 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 251,139 downloads/mo, #8,595 on PyPI
Alternatives
Verify before relying
pip install htbuilder
from htbuilder import div, ul, li
dom = div(id='container')[
ul(_class='items')[
li('item 1'),
li('item 2'),
]
]
print(dom)- Whether high install friction (source-only distribution) impacts real-world adoption or if wheels are available through alternative channels.
- Performance characteristics when building large or deeply nested HTML structures.
- Whether dormant maintenance status affects compatibility with newer Python versions beyond 3.7.
What it is and what it does
htbuilder is a lightweight HTML string generator that replaces template languages with pure Python function calls. Instead of writing HTML templates or concatenating strings, you import tag names (div, span, ul, etc.) as functions and call them with content and attributes as arguments. The package supports multiple syntaxes—positional arguments, keyword arguments, chained calls with parentheses, or bracket notation—so you can choose the style that reads most naturally to you.
The core value is that HTML generation becomes just Python: you can use loops, conditionals, and variables directly in your markup without template syntax. It also provides helper functions for common patterns like building style strings, class lists, and CSS units. With no runtime dependencies and a permissive license, it's a minimal, self-contained tool for scenarios where you need to generate HTML programmatically rather than render from a template.
Use it for
- Generate HTML email bodies or reports dynamically in Python without learning a template language.
- Build web scraper output or data-driven HTML documents where structure depends on runtime conditions.
- Construct HTML fragments in web frameworks (e.g., Streamlit, FastAPI) where inline Python markup is clearer than templates.
- Programmatically create test fixtures or mock HTML responses in unit tests.
- Generate static site content or documentation where HTML structure is computed from data structures.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you prefer writing HTML in Python and don't need frequent updates.
The package is stable, has no security vulnerabilities, and solves a real problem for developers who dislike template syntax. The dormant maintenance and source-only distribution are minor friction, but the zero runtime dependencies and permissive license make it low-risk for projects that can tolerate infrequent upstream changes.
Install
htbuilder on PyPI
Before you install
Installation friction is high—the package ships as a source distribution only. Maintenance is dormant: the last commit was 2025-01-09, but the prior release cycle was 582 days earlier, suggesting infrequent updates. The repository remains active (not archived) with 104 stars.
Requires Python 3.7 or later.
License in practice
Licensed under Apache 2 (permissive), which allows commercial and private use with minimal restrictions. No notable licensing constraints for most use cases.
Quickstart
pip install htbuilder
from htbuilder import div, ul, li
dom = div(id='container')[
ul(_class='items')[
li('item 1'),
li('item 2'),
]
]
print(dom)
Verify before relying
- Whether high install friction (source-only distribution) impacts real-world adoption or if wheels are available through alternative channels.
- Performance characteristics when building large or deeply nested HTML structures.
- Whether dormant maintenance status affects compatibility with newer Python versions beyond 3.7.
Package facts
| License | Apache 2 permissive |
| Python support | Supports the current Python release >=3.7 |
| Install friction | High. Source build required |
| Runtime dependencies | None |
| Maintenance | Dormant 582 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 251,139 / month, #8,595 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | License :: OSI Approved :: Apache Software LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3 |
Evidence: htbuilder-0.9.0.tar.gz
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “html string builder python”
- htbuilderhtbuilder lets you construct HTML strings using Python function calls…
- MarkupPyMarkupPy generates HTML and XML markup from Python code using an…
- html5taggerGenerates HTML5 markup programmatically using Python syntax instead…
Give your agent the search over MCP, or paste the wish link into any chat.
More HTML packages
MarkupSafe provides a text object that escapes special characters so untrusted strings can be safely embedded in HTML and XML without injection attacks.
Jinja2 is a templating engine that renders dynamic content by combining templates with Python-like syntax and data, supporting template inheritance, macros, autoescaping, and sandboxed execution.
Beautiful Soup parses HTML and XML documents into a navigable tree, providing Pythonic methods to search, iterate, and modify the parsed content.
Install it if you need to parse or extract data from markup documents.
lxml provides Python bindings to libxml2 and libxslt, enabling parsing, validation, and transformation of XML and HTML documents through an ElementTree-compatible API with support for XPath, XSLT, and schema validation.
Install it if you need robust XML/HTML parsing, validation, or transformation; avoid it only if you must stay pure-Python and can accept slower performance.
Docutils converts plaintext documentation in reStructuredText format into multiple output formats including HTML, XML, and LaTeX using a modular processing system.
Converts Markdown text to HTML using a Python implementation of John Gruber's Markdown specification, with support for extensions.
Install it if you need to parse Markdown in Python.
See also htpy · hyperscript · htmlBuilder · tinyhtml · dominate · html5tagger · htag · branca · meld3 · htmltools