Skip to main content

webfast

Fast HTML Abstraction and Generator for Python.

You're building the next big thing and definitely writing the perfect HTML file is not on the priority.

WebFast let's you create HTML documents on the go and inside your Python scripts. It is built on top of lxml.html plus with another level of abstraction, so you can code with no trouble of messing up with closing tags--it is so quick and easy!

Here's a sample syntax:

page[".selector"] = "tag #id.class property='10' > inner text"

And scroll down below for more examples.

Official Release

WebFast can now be used on your Python projects through PyPi by running pip command on a Python-ready environment.

pip install -U webfast

Current version is 1.1, but more updates are coming soon.

This is compatible with Python 3.9+, but will require other third-party libraries during installation.

Usage

Import Package

from webfast import WebFast

Initialization

page = WebFast()
page = WebFast("home.html")

Import Package

page["head"] = "title > WebFast v1.0"

Import Package Basically, you set the parent selector to append the new element.

# create container box
page["body"] = "div #content"
page["#content"] = "div #box.container.light"

# create the popup text
page["#box"] = "div #title.header > WebFast"
page["#box"] = "div .message data-default='Lorem impsum...' > Hello, world!"

# populate the action buttons
page["#box"] = "div #action.btn-list"
page["#action"] = "button #btn1.btn.btn-no style='background-color:#b22222;color:#fff;' > CLOSE"
page["#action"] = "button #btn2.btn.btn-maybe > LATER"

# using lxml xpath
page[".//div[@id='action']"] = "button #btn3.btn.btn-yes > CONTINUE"

Setting Properties

page["html"] = "lang=en" # not yet allowed in lxml
page["body"] = "#canvas"

Yield all matches

for element in page["button"]:
    print(element.tag)

Yield all matches as HTML string

for element in page.get("button", to_string=True, to_xml=True):
    print(element)

Save to HTML file

page.save()
page.save("newFile.html")

Metadata

Release files for webfast 1.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for webfast 1.1.1
File Size Uploaded Provenance Actions
webfast-1.1.1.tar.gz 10.7 kB Without provenance Details for webfast-1.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for webfast 1.1.1
File Interpreter ABI Platform Actions
webfast-1.1.1-py3-none-any.whl Python 3 none any Details for webfast-1.1.1-py3-none-any.whl

Total release size: 20.6 kB

Release files / webfast-1.1.1.tar.gz

Download URL webfast-1.1.1.tar.gz
Size 10.7 kB
Tags Source
SHA-256 checksum
How to use checksums
da9d947816aeb0fb24d1ee8ae78a4107ef2ff771cff54c911bdef2e7d31bf4ac
BLAKE2b-256 checksum
How to use checksums
70e7ad8f25b19c282d5d3c07106a275146eccebe648b752e4aeaa51fddba9d2a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.10.4

Release files / webfast-1.1.1-py3-none-any.whl

Download URL webfast-1.1.1-py3-none-any.whl
Size 9.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
63e4d504ccc2132103fdc397b2b992fe67e5bfa0ead18b838e007481a13e7382
BLAKE2b-256 checksum
How to use checksums
ca6a1abfb661c89797cfa7cf4787a6cb9f586e10e61aba88e7db6db261647737
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.10.4

Security for webfast 1.1.1

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page