htmltools
Tools for HTML generation and output.
Decision gist · record as of 2026-08-14
Yes. htmltools is a lightweight, actively maintained library with no known vulnerabilities, permissive licensing, and minimal dependencies. It fills a clear niche for programmatic HTML generation in Python. Install it if you need to build HTML dynamically from code rather than using string templates or a heavier templating framework.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.10 or later.
- Low install friction with only two lightweight runtime dependencies (typing-extensions and packaging).
- Active maintenance with a recent release 85 days ago and ongoing repository activity.
License · maintenance · safety
permissive license (permissive) — MIT License permits unrestricted use, modification, and distribution in both open-source and commercial projects, with only the requirement to include the license notice.
last release 2026-05-21 (85 days) · last repo commit 2026-08-14 · 24 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 917,074 downloads/mo, #4,726 on PyPI
Alternatives
Verify before relying
pip install htmltools
from htmltools import HTML, div, p
html_content = div(
p("Hello, World!"),
id="container"
)
print(html_content.render())- Whether the package supports streaming or incremental HTML rendering for large documents.
- Performance characteristics when generating very large HTML structures.
- Availability and completeness of API documentation beyond the repository README.
What it is and what it does
htmltools is a Python library for building HTML documents and fragments programmatically. It provides a set of functions and classes to construct HTML elements, nest them, set attributes, and render them to strings. The library is designed for developers who need to generate HTML dynamically from Python code—whether for web applications, templating systems, or documentation generation.
The package depends only on typing-extensions and packaging, keeping its footprint minimal. It supports modern Python versions from 3.10 onward and is actively maintained. The library fits into workflows where HTML generation is a core task but a full templating engine may be overkill, making it suitable for programmatic HTML construction in frameworks, data reporting tools, or custom HTML builders.
Use it for
- Generate HTML reports or dashboards programmatically from Python data structures.
- Build HTML fragments dynamically in web frameworks or template systems.
- Construct email bodies or HTML documents for automated document generation.
- Create interactive HTML output for Jupyter notebooks or data analysis tools.
- Serialize Python objects to structured HTML for web display or export.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
htmltools is a lightweight, actively maintained library with no known vulnerabilities, permissive licensing, and minimal dependencies. It fills a clear niche for programmatic HTML generation in Python. Install it if you need to build HTML dynamically from code rather than using string templates or a heavier templating framework.
Install
htmltools on PyPI
Before you install
Low install friction with only two lightweight runtime dependencies (typing-extensions and packaging). Active maintenance with a recent release 85 days ago and ongoing repository activity.
Requires Python 3.10 or later.
License in practice
MIT License permits unrestricted use, modification, and distribution in both open-source and commercial projects, with only the requirement to include the license notice.
Quickstart
pip install htmltools
from htmltools import HTML, div, p
html_content = div(
p("Hello, World!"),
id="container"
)
print(html_content.render())
Verify before relying
- Whether the package supports streaming or incremental HTML rendering for large documents.
- Performance characteristics when generating very large HTML structures.
- Availability and completeness of API documentation beyond the repository README.
Package facts
| License | permissive license permissive |
| Python support | Supports the current Python release >=3.10 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 2 packagestyping-extensionspackaging |
| Maintenance | Actively maintained 85 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 917,074 / month, #4,726 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseProgramming Language :: PythonProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: Implementation :: PyPyTopic :: Internet :: WWW/HTTP :: Dynamic ContentTopic :: Software Development :: Libraries :: Python ModulesTopic :: Text Processing :: Markup :: HTML |
Evidence: htmltools-0.7.0-py3-none-any.whl
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 › “create html programmatically”
- htmltoolshtmltools provides Python functions to programmatically create,…
- brancaBranca generates HTML and JavaScript pages from Python code using…
- django-crispy-formsRenders Django forms programmatically with full HTML control using…
Give your agent the search over MCP, or paste the wish link into any chat.
More Python Modules packages
Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.
Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.
Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.
PyYAML parses and emits YAML 1.1 data format, enabling serialization and deserialization of configuration files and Python objects to and from human-readable YAML text.
Pydantic validates Python data structures against type hints, coercing and checking input at runtime to ensure it matches a declared schema.
Provides reusable metadata objects for use with PEP-593 `typing.Annotated` to express common constraints like bounds, collection sizes, and predicates on types.
Install it if you use or build libraries that need to express type constraints in a standardized, inspectable way—or if you want to annotate your own types with…
Provides runtime tools to inspect and introspect Python type annotations, enabling programmatic examination of type hints at execution time.
See also htmlBuilder · mdutils · yattag · hyperscript · html5tagger · htbuilder · dominate · Sphinx · aspose-slides · prosemirror