DSL for writing HTML user interfaces in Python.
Project description
Aether
Build HTML user interfaces in Python.
Introduction
Aether is a DSL that lets you build HTML components as Python objects, offering a clean, component-based approach that avoids the complexities of traditional templating engines. Create reusable components that generate HTML fragments to build complex views, pages, or even entire web applications, all within your Python workflow.
Getting Started
Installation:
pip install pyaether
Simple Example:
from aether.tags.html import H1, Div, P
from aether import render
page = Div(_class="container")(
H1()("My Awesome Page"),
P()("This is a paragraph of text.")
)
print(render(page))
This will output neatly formatted HTML.
Advanced Example 1: Dynamic Content and Components
from aether.tags.html import Li, Span, Ul
from aether import render
items = ["apple", "banana", "cherry"]
item_list = Ul()(Li()(item) for item in items)
name = "Alice"
greeting = Span()(f"Hello, {name}!")
print(render(Div()(greeting, item_list)))
This demonstrates creating dynamic content and nesting components. The output will be an HTML <div> containing a greeting and the unordered list of fruits.
Advanced Example 2: HTMX Support
from aether.tags.html import Div, Button, Img
from aether import render
click_to_load = Div(id="replace_me")(
Button(
_class="btn primary",
hx_get="/example/?data=1",
hx_target="#replace_me",
hx_swap="outerHTML",
)(
"Load More Data...",
Img(_class="htmx-indicator", src="/img/bars.svg", alt="Loading..."),
)
)
print(render(click_to_load))
Backwards Compatibility Note
This project is under active development and has not yet reached v1.0.0. This means that while we are working hard to build the best possible package, we may need to make changes that affect how your code works.
Version Stability:
- Minor Version Updates (e.g., 0.1.x -> 0.2.x): These updates may introduce breaking changes as we refine and improve the package's functionality and APIs.
- Patch Version Updates (e.g., 0.1.1 -> 0.1.2): These updates will maintain compatibility within the same minor version and generally include bug fixes or small enhancements.
To avoid unexpected disruptions, it is recommended to pin your dependency to a specific minor version (v0.x) and carefully review release notes before upgrading to a new minor version.
We appreciate your understanding and welcome feedback as we work towards a stable and robust v1.0.0!
License
This project is licensed under the BSD-2-Clause License
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyaether-0.4.4.tar.gz.
File metadata
- Download URL: pyaether-0.4.4.tar.gz
- Upload date:
- Size: 69.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.8.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1baa64399e6da40ef3db59ad9996e2dfc3e74baebe6e2a065e3b72d7c122c546
|
|
| MD5 |
239bc6863cc9c5e0d0b872bfd0e3e7ca
|
|
| BLAKE2b-256 |
dc80812aaeffd7ef1a6a531e91638fce4f6d012bab72f2d22c5895affd443565
|
File details
Details for the file pyaether-0.4.4-py3-none-any.whl.
File metadata
- Download URL: pyaether-0.4.4-py3-none-any.whl
- Upload date:
- Size: 112.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.8.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c5da8b985158b49bdd03b3cfd49bfd32264cc9688db97302eaa3a4a75b5d7beb
|
|
| MD5 |
b5f169b9365acad4bf36510337fdccc0
|
|
| BLAKE2b-256 |
90eb7951f72cae6b0effd71426d4859f345ebeaebe6e9e5bf38a56949ad1217a
|