skillfed

hyperscript

HyperText with Python

hyperscript v0.3.0 511.8K downloads/30d#6,258 on PyPI11
Permissive license MIT License DORMANT released

What it is and what it does

Hyperscript is a lightweight Python library for building HTML markup using function calls rather than string concatenation or templates. You pass an element selector (tag name, optional class and id), attributes as a dictionary, and content as positional arguments, and it returns an HTML string. It supports nested elements, inline styles, boolean attributes, and class/id shorthand syntax similar to CSS selectors.

The library has no runtime dependencies and installs cleanly on Python 3.8+. It is dormant—the repository is not archived but has seen no commits since late 2024 and no releases in several months—so it is stable but not actively developed. It carries no known security vulnerabilities and is licensed under MIT, making it safe to use in most projects.

Use it for:

  • Generate HTML snippets programmatically in web frameworks or static site generators without writing raw HTML strings.
  • Build email templates or HTML reports dynamically from Python data structures.
  • Create test fixtures or mock HTML for unit tests without external template files.
  • Construct simple HTML documents or fragments in CLI tools or data processing scripts.
  • Prototype web page layouts in Jupyter notebooks or interactive Python environments.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Hyperscript lets you generate HTML markup programmatically using Python function calls instead of writing HTML strings directly.

Yes, if you need lightweight programmatic HTML generation without template overhead. The package is stable, dependency-free, and permissively licensed. However, it is dormant—no active maintenance—so use it only for straightforward markup tasks where you do not expect ongoing support or feature additions. For complex templating or large-scale web applications, consider a maintained alternative.

Install

hyperscript on PyPI

pip

pip install hyperscript

uv

uv add hyperscript

poetry

poetry add hyperscript

Installing hyperscript

Before you install

Installation is straightforward with no runtime dependencies. The package is dormant—last commit was 2024-12-21 and no release since 2024-10-22—so expect no active maintenance or rapid bug fixes.

License in practice

MIT License is permissive, allowing commercial and private use with minimal restrictions; you may use, modify, and distribute the package freely provided you retain the license notice.

Quickstart

pip install hyperscript
from hyperscript import h
print(h("p.greeting#msg", "Hello world!"))

Requires Python 3.8 or later.

Verify before relying

  • Whether the package handles edge cases in attribute rendering (e.g., data attributes, custom namespaces) beyond the documented examples.
  • Performance characteristics when generating large or deeply nested HTML structures.
  • Whether there is a way to output formatted/pretty-printed HTML or only minified output.

Package facts

License MIT License (permissive)
Python support supports the current Python release (>=3.8)
Install friction low — pure-Python wheel
Runtime dependencies none
Maintenance dormant — 661 days since the last release
Last repo commit
First released
Downloads 511,792/month — #6,258 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: hyperscript-0.3.0-py3-none-any.whl

Intended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3Topic :: Text Processing :: Markup :: HTML

Tags

python html generationwrite html with pythonhtml builder libraryprogrammatic markup generationhtml dsl pythondom creation pythonhtml templating alternative
html-generationmarkup-builder

More HTML packages