tinyhtml
A tiny library to safely render compact HTML5 from Python expressions.
Decision gist · record as of 2026-08-14
Yes, if you need lightweight HTML generation with safety guarantees. Zero dependencies and low install friction make it easy to adopt. Dormant maintenance is acceptable for a stable, narrow-scope library—no active bugs or vulnerabilities are known. Best suited for projects that prefer functional composition over template strings and don't require advanced features like comments or inline SVG.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Low friction: pure Python wheel with no runtime dependencies.
- Maintenance is dormant—last release was 580 days ago, but the repository remains active with a recent commit on 2025-01-11 and no archived status.
License · maintenance · safety
MIT/Apache-2.0 (permissive) — Dual-licensed under MIT and Apache License 2.0, both permissive. You may choose either license, giving flexibility for most projects.
last release 2025-01-11 (580 days) · last repo commit 2025-01-11 · 20 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 104,254 downloads/mo, #12,758 on PyPI
Alternatives
Verify before relying
pip install tinyhtml
from tinyhtml import h, frag
result = h("div", klass="container")(
h("h1")("Hello"),
h("p")("World")
).render()
print(result)- Whether dormant maintenance (580 days since release) affects long-term compatibility with future Python versions beyond 3.13.
- Performance characteristics when rendering very large HTML structures or deeply nested fragments.
What it is and what it does
tinyhtml is a minimal Python library for building and rendering HTML5 safely. It provides a functional API where you compose HTML elements using the `h()` function, nest them by calling the result with child content, and render to a string. All text content and attributes are automatically escaped to prevent injection, with a `raw()` escape hatch for intentional unescaped HTML. The library produces compact output with no superfluous whitespace.
It integrates with Jupyter notebooks via `_repr_html_()` and works with the `__html__` protocol used by MarkupSafe and other template systems. You can write reusable templates as Python functions returning fragments, pass iterables as child elements, and use boolean or dictionary-valued attributes. The library includes mypy typings and supports Python 3.8 through 3.13.
Use it for
- Generate HTML dynamically in web applications or scripts without string concatenation or template files.
- Build Jupyter notebook outputs programmatically with safe escaping and clean composition.
- Create email templates or HTML reports by composing fragments as Python functions.
- Integrate with Jinja2 or other template systems that support the `__html__` protocol.
- Render pandas DataFrames or other objects with `_repr_html_()` support alongside custom HTML.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you need lightweight HTML generation with safety guarantees.
Zero dependencies and low install friction make it easy to adopt. Dormant maintenance is acceptable for a stable, narrow-scope library—no active bugs or vulnerabilities are known. Best suited for projects that prefer functional composition over template strings and don't require advanced features like comments or inline SVG.
Install
tinyhtml on PyPI
Before you install
Low friction: pure Python wheel with no runtime dependencies. Maintenance is dormant—last release was 580 days ago, but the repository remains active with a recent commit on 2025-01-11 and no archived status.
License in practice
Dual-licensed under MIT and Apache License 2.0, both permissive. You may choose either license, giving flexibility for most projects.
Quickstart
pip install tinyhtml
from tinyhtml import h, frag
result = h("div", klass="container")(
h("h1")("Hello"),
h("p")("World")
).render()
print(result)
Verify before relying
- Whether dormant maintenance (580 days since release) affects long-term compatibility with future Python versions beyond 3.13.
- Performance characteristics when rendering very large HTML structures or deeply nested fragments.
Package facts
| License | MIT/Apache-2.0 permissive |
| Python support | Supports the current Python release >=3.8 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | None |
| Maintenance | Dormant 580 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 104,254 / month, #12,758 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 :: Apache Software LicenseLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Internet :: WWW/HTTPTopic :: Software Development :: Libraries :: Python ModulesTopic :: Text Processing :: Markup :: HTMLTyping :: Typed |
Evidence: tinyhtml-1.3.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 › “functional html templates”
- tinyhtmlRenders HTML5 safely from Python expressions using a functional API…
- htbuilderhtbuilder lets you construct HTML strings using Python function calls…
- django-webtestIntegrates WebTest with Django's testing framework to enable…
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 html5tagger · htbuilder · htpy · htmlBuilder · hyperscript · html-void-elements · tinyhtml5 · airium · draftjs_exporter · python-liquid