DOM Tree
Simple API to create DOM trees in Python. A bit like JSX, but with native Python syntax.
Aims to include useful autocompletion. Currently this works for SVGs.
Basic example
from domtree.svg import *
print(
svg(viewBox="0 0 100 100", xmlns="http://www.w3.org/2000/svg")(
circle(cx=50, cy=50, r=50),
)
)
# <svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg">
# <circle cx="50" cy="50" r="50" />
# </svg>
Generated content
from domtree.svg import *
print(
svg(
circle(x=0, y=i * 10, r=2) for i in range(5)
)
)
# <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1">
# <circle x="0" y="0" r="2" />
# <circle x="0" y="10" r="2" />
# <circle x="0" y="20" r="2" />
# <circle x="0" y="30" r="2" />
# <circle x="0" y="40" r="2" />
# </svg>
Custom nodes
from domtree import Node
ul = Node("ul")
li = Node("li")
print(
ul(
li("First item"),
li(className="second")("Second item")
)
)
# <ul>
# <li>
# First item
# </li>
# <li class="second">
# Second item
# </li>
# </ul>
Autocomplete
Metadata
Release files for domtree 0.0.5
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 |
|---|---|---|---|---|
| domtree-0.0.5.tar.gz | 240.9 kB | Without provenance | Details for domtree-0.0.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| domtree-0.0.5-py3-none-any.whl | Python 3 | none | any | Details for domtree-0.0.5-py3-none-any.whl |
Total release size: 262.4 kB
Release files / domtree-0.0.5.tar.gz
| Download URL | domtree-0.0.5.tar.gz |
|---|---|
| Size | 240.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b33fe5a800d8a261594584b59aead58f984ea0b1f9b61eeed787a78bb01952c1
|
|
BLAKE2b-256 checksum How to use checksums |
edff8b5bcf64793ad3a8f1bd6fa7a8199f5c374db72a48e7a68fdc4101274366
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.15
|
Release files / domtree-0.0.5-py3-none-any.whl
| Download URL | domtree-0.0.5-py3-none-any.whl |
|---|---|
| Size | 21.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3eeb82846eb42cdc21ce0fa3a84195fec8cadd91ebff4a47885982676a2d10de
|
|
BLAKE2b-256 checksum How to use checksums |
afaf75449470c04bfb7d39e3287ed90f0e52633fac9070cc9c00c9290a53aa92
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.15
|
Security for domtree 0.0.5
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.