sodom if you like to write HTML in Python.
Project description
sodom
sodom if you like to write HTML in Python. Faster x2.5 than dominate
Installation
python -m pip install sodom
Examples
You can check demo via python -m sodom
or preview code in sodom.__main__
.
from sodom import *
...
def card(_header: str, _price: str, _submit_text: str, *_conditions: str):
with div(class_='card mb-4 box-shadow'):
with div(class_='card-header'), h4(class_='my-0 font-weight-normal'):
text(_header)
with div(class_='card-body'):
with h1(class_='card-title pricing-card-title'):
text(_price)
with small(class_='text-muted'):
text(' mo')
with ul(class_='list-unstyled mt-3 mb-4'):
for _c in _conditions:
li(_c)
with button(type_='button', class_='btn btn-lg btn-block btn-primary'):
text(_submit_text)
...
Features
- supported standart html element (normal/void). Check
sodom.consts.NORMAL_TAGS
andsodom.consts.VOID_TAGS
. - supported several special attributes like
data-
,v-
... Checksodom.consts.SPECIAL_ATTRS
. You can extend them in runtime before library usage. - sodom is 2.5 times more productive than
dominate
(1.6 ifSODOM_TAG_CACHE=0
) and ~5.5-6 times thanfast_html
. Checksodom.tests.test_performance_*
. - avoided builtin keyword trouble via cutting off leading and ending
_
. For example,[py]class_='button'
equals[html]class="button"
. - supported
ContextVar
. Tested onasyncio
andThreadPool
.
Environment Variables
SODOM_TAG_CACHE=128
- cache size, check it
Feedback
If you have any feedback, text me at inbox@protaz.ru
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
sodom-1.0.0.post1.tar.gz
(11.8 kB
view details)
File details
Details for the file sodom-1.0.0.post1.tar.gz
.
File metadata
- Download URL: sodom-1.0.0.post1.tar.gz
- Upload date:
- Size: 11.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.12.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6f776705262751248bd17a129f23ee2b1e9d4a3a4df031031e35f4aafd453604 |
|
MD5 | 7356bf60399d9f5e3023da164de90cc0 |
|
BLAKE2b-256 | 9d478753f055cf6332d8644b16e25e4a1478dc712fda74b7216563a53f2d94ca |