minihtml - Simple HTML Generation
minihtml is a library to generate HTML documents from Python. It aims to provide an API that allows you to define the structure of an HTML document in a succinct and natural way.
By building up nested HTML elements using context managers, you can combine HTML generation with control flow statements in a way that is easy to read and does not obscure the structure of the resulting HTML document.
Installation
Install the minihtml package from PyPI:
pip install minihtml
or
uv add minihtml
Example
A basic "hello, world" example:
>>> from minihtml.tags import html, head, title, body, div, p, a, img
>>> with html(lang="en") as elem:
... with head:
... title("hello, world!")
... with body, div["#content main"]:
... p("Welcome to ", a(href="https://example.com/")("my website"))
... img(src="hello.png", alt="hello")
...
<...>
>>> print(elem)
<html lang="en">
<head>
<title>hello, world!</title>
</head>
<body>
<div id="content" class="main">
<p>Welcome to <a href="https://example.com/">my website</a></p>
<img src="hello.png" alt="hello">
</div>
</body>
</html>
Links
License
Minihtml is released under the MIT license. See LICENSE for more information.
Metadata
Release files for minihtml 0.2.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| minihtml-0.2.3.tar.gz | 940.9 kB | Without provenance | Details for minihtml-0.2.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| minihtml-0.2.3-py3-none-any.whl | Python 3 | none | any | Details for minihtml-0.2.3-py3-none-any.whl |
Total release size: 954.0 kB
Release files / minihtml-0.2.3.tar.gz
| Download URL | minihtml-0.2.3.tar.gz |
|---|---|
| Size | 940.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2c7419de9ffcd63f155b279c386129db71d4d2aa9df8ed8a49f61e8871eb6f99
|
|
BLAKE2b-256 checksum How to use checksums |
baf63f246f9bd90ee32774fa2fed9d4411382f6252d53842158cddf2a8a51fb1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.6.12
|
Release files / minihtml-0.2.3-py3-none-any.whl
| Download URL | minihtml-0.2.3-py3-none-any.whl |
|---|---|
| Size | 13.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3ecf34672fbd22ace997ed2a1806b6b295c0b88757c7f8edf4e7695b66e0a0c8
|
|
BLAKE2b-256 checksum How to use checksums |
a64c85b4ec3f1a2122981b07dbbb6916e87be6254f49ee587f03b50308bf3d70
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.6.12
|
Security for minihtml 0.2.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.