airium
Easy and quick html builder with natural syntax correspondence (python->html). No templates needed. Serves pure pythonic library with no dependencies.
What it is and what it does
Airium is a Python library that generates HTML by treating DOM structure as Python indentation and context managers, eliminating the need for separate template files. Instead of writing HTML templates, you write Python code where nesting is expressed through `with` statements, and element attributes and text are passed as function arguments. The library supports both pretty-printed (indented, human-readable) and minified output modes.
The package also includes a reverse translator to parse existing HTML back into Python code. It has no external dependencies, works across Python 3.8 through 3.13 and PyPy, and can be integrated into web frameworks like Flask or Django to replace template engines entirely. Output can be cast to string or UTF-8 bytes directly.
Use it for:
- Generate HTML programmatically in Flask or Django views without writing separate template files
- Build dynamic HTML tables, forms, or page structures where the layout is determined by Python logic
- Create minified HTML output for production when file size matters
- Convert existing HTML documents into Python code for programmatic manipulation
- Generate email HTML bodies or static site content from pure Python
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Airium generates HTML from Python code using indentation and context managers instead of templates, and can also parse HTML back into Python.
Yes, if you prefer writing HTML in Python over templates and want zero external dependencies. The package is stable (Beta status, no known vulnerabilities) but aging—last release was 430 days ago. Suitable for small to medium projects; verify performance and framework integration for your specific use case before adopting in production.
Install
airium on PyPI
pip
pip install airiumuv
uv add airiumpoetry
poetry add airiumInstalling airium
Before you install
No runtime dependencies and a pure-Python wheel distribution make installation straightforward. The package is aging (430 days since last release) but carries a Beta status and has received recent maintenance as of 2025-06-10.
License in practice
MIT license is permissive, allowing free use, modification, and distribution in both open-source and proprietary projects with minimal restrictions.
Quickstart
from airium import Airium
a = Airium()
a('<!DOCTYPE html>')
with a.html():
with a.body():
a.h1(_t='Hello World')
print(str(a))
Verify before relying
- Whether the reverse translator (HTML to Python) is production-ready or limited to specific HTML patterns
- Performance characteristics when generating large or deeply nested HTML documents
- Compatibility with modern web frameworks beyond the Django example shown
Package facts
| License | MIT (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | aging — 430 days since the last release |
| First released | |
| Downloads | 96,967/month — #13,182 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: airium-0.2.7-py3-none-any.whl
Keywords: natural, html, generator, compiler, template-less
Tags
More WWW/HTTP packages
urllib3 is an HTTP client library that provides…
permissive · top 100 on PyPI
requestsRequests is a Python HTTP library that…
permissive · top 100 on PyPI
h11h11 is a pure-Python HTTP/1.1 protocol…
permissive · top 100 on PyPI
httpxHTTPX is a fully featured HTTP client library…
permissive · top 100 on PyPI
httpcoreA minimal low-level HTTP client library that…
permissive · top 100 on PyPI
aiohttpaiohttp is an async HTTP client and server…
permissive · top 100 on PyPI
hyperscriptHyperscript lets you generate HTML markup…
permissive · top 15,000 on PyPI
dominateDominate is a Python library for writing HTML…
copyleft · top 5,000 on PyPI
tinyhtmlRenders HTML5 safely from Python expressions…
permissive · top 15,000 on PyPI
html2imageGenerates PNG/image files from HTML, CSS, and…
permissive · top 15,000 on PyPI
htbuilderhtbuilder lets you construct HTML strings using…
permissive · top 15,000 on PyPI
htmlBuilderRender HTML by writing Python code, using…
permissive · top 15,000 on PyPI
brancaBranca generates HTML and JavaScript pages from…
permissive · top 5,000 on PyPI
meld3meld3 is an HTML/XML templating system that…
permissive · top 15,000 on PyPI
py-markdown-tableGenerates formatted markdown tables from lists…
permissive · top 5,000 on PyPI
html5taggerGenerates HTML5 markup programmatically using…
permissive · top 5,000 on PyPI