Hyperscript
Hyperscript is a lightweight library that allows you to write HTML with Python. It is heavily inspired by HyperScript.
Example usage
>>> print(h("p", "Hello world!"))
<p>Hello world!</p>
Class and id selectors
>>> print(h("p.class1#id", "Hello world!"))
<p class="class1" id="id">Hello world!</p>
Style
>>> print(h("p", "Hello world!", {"style": {"color": "red"}}))
<p style="color: red">Hello world!</p>
Nesting elements
>>> print(h("div", h("p", "Hello world!")))
<div><p>Hello world!</p></div>
Attributes
>>> print(h("a", {"href": "https://www.example.com"}, "link"))
<a href="https://www.example.com">link</a>
Boolean attributes
>>> print(h("input", {"type": "checkbox", "checked": True})) # Behavior is the same if "checked" is None
<input type="checkbox" checked>
>>> print(h("input", {"type": "checkbox", "checked": ""}))
<input type="checkbox" checked="">
>>> print(h("input", {"type": "checkbox", "checked": False}))
<input type="checkbox">
Filtering out empty elements
>>> print(h("div", h("p", "Hello"), h("div", ""), h("p", "world!")))
<div><p>Hello</p><div></div><p>world!</p></div>
>>> print(h("div", h("p", "Hello"), h("div", ""), h("p", "world!"), remove_empty=True))
<div><p>Hello</p><p>world!</p></div>
Metadata
Release files for hyperscript 0.3.0
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 |
|---|---|---|---|---|
| hyperscript-0.3.0.tar.gz | 7.5 kB | Without provenance | Details for hyperscript-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| hyperscript-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for hyperscript-0.3.0-py3-none-any.whl |
Total release size: 12.5 kB
Release files / hyperscript-0.3.0.tar.gz
| Download URL | hyperscript-0.3.0.tar.gz |
|---|---|
| Size | 7.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
77e9372c09dbf0ec0e18515cd7e13a44cac7cbf800362a1eac26d9f8c4abe2a8
|
|
BLAKE2b-256 checksum How to use checksums |
f1823494aa2c07252755d0e77068239712c35c897fca0830dfd8525369eae67d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.1.1 CPython/3.12.7
|
Release files / hyperscript-0.3.0-py3-none-any.whl
| Download URL | hyperscript-0.3.0-py3-none-any.whl |
|---|---|
| Size | 5.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5b1689c5cd4ab7c076a0bc61bff11200aa2e0e788bb50358be496e77924df4f0
|
|
BLAKE2b-256 checksum How to use checksums |
d42d05a668e7dd7eaf0d7ee9bc162ebf358e9be9af43e4720cdecf622ccc6c9b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.1.1 CPython/3.12.7
|
Security for hyperscript 0.3.0
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.