Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyaether-0.4.15.tar.gz (70.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyaether-0.4.15-py3-none-any.whl (114.8 kB view details)

Uploaded Python 3

File details

Details for the file pyaether-0.4.15.tar.gz.

File metadata

  • Download URL: pyaether-0.4.15.tar.gz
  • Upload date:
  • Size: 70.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for pyaether-0.4.15.tar.gz
Algorithm Hash digest
SHA256 bf3f402d935410696ee0e980b1924375a11fc8245640cfa6b75a476b914bab8e
MD5 554585570c47699566a5b4ee20e44aa5
BLAKE2b-256 55defc4891586be6b1e9059e445e5e18d7f2f6a4d703be7d17c27758d44e4f33

See more details on using hashes here.

File details

Details for the file pyaether-0.4.15-py3-none-any.whl.

File metadata

  • Download URL: pyaether-0.4.15-py3-none-any.whl
  • Upload date:
  • Size: 114.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for pyaether-0.4.15-py3-none-any.whl
Algorithm Hash digest
SHA256 157efd8af17a4d48d047c60b8436bc8680c772149a6679495069841ec17e14ab
MD5 527fe5dbd6b79a65c2febfb9fe3d902c
BLAKE2b-256 6bc5ce93cdc56465debb40a94f57b64a86941a02a077f0d8d5bb41cf9ec457b9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page