Skip to main content

without-html

HTML as immutable Python values. Build a node tree with plain function calls, render it to a string with a pure function. No template language, no loader search path, no ambient application object, and no dependency on anything else in the workspace: this is a value library that happens to be useful next to without-web.

from without_asgi import Response, html_content
from without_html import render, table, tbody, td, th, thead, tr


def runs_table(runs):  # a component is a function that returns a node
    return table(
        cls=["table", "table-striped"],
        children=[
            thead(children=tr(children=[th(children="run"), th(children="status")])),
            tbody(children=(run_row(run) for run in runs)),
        ],
    )


def run_row(run):
    return tr(attrs={"id": f"run-{run.id}"}, children=[td(children=run.id), td(children=run.status)])


Response.from_content(200, html_content(render(runs_table(runs))))

Escaping is a type rather than a setting: text is escaped on the way in, and Markup (MarkupSafe's own, kept under its own name, so anything Jinja or tdom produced is already one) is the only thing that renders verbatim. The element constructors carry HTML's own constraints in their signatures, so a void element with children and an unescaped <script> body are type errors rather than runtime surprises.

render returns the whole string; render_chunks walks the same tree and yields the same bytes a chunk at a time, so a large page starts reaching a client while the rest of it is still being built.

The tree is the interface, not the string: a component can be rendered whole for a page or on its own for a fragment, and syntax sugar can be layered on later without changing anything written against it.

See the without-html guide (with the API reference) for nodes and escaping, the attribute rules, custom elements, and what this deliberately does not do.

Metadata

Release files for without-html 0.0.10

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

Source distribution (sdist)

Source distribution for without-html 0.0.10
File Size Uploaded
without_html-0.0.10.tar.gz 19.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for without-html 0.0.10
File Interpreter ABI Platform
without_html-0.0.10-py3-none-any.whl Python 3 none any Details

Total release size: 41.2 kB

Release files / without_html-0.0.10.tar.gz

Download URL without_html-0.0.10.tar.gz
Size 19.4 kB
Tags Source
SHA-256 checksum
How to use checksums
010ef766cc95e5714566a8fce76749b97b210b36b80261c28012a5a9d6aee02a
BLAKE2b-256 checksum
How to use checksums
4324275fcd72353b3601de005569f0013e4f9112ef2cf41543cb9bdb595cd210
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.23 {"installer":{"name":"uv","version":"0.12.23","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}

Release files / without_html-0.0.10-py3-none-any.whl

Download URL without_html-0.0.10-py3-none-any.whl
Size 21.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
468414a99143c6405a0eed65b5e7e8c54d4511d9e03c514c4a5c3ad339e1f434
BLAKE2b-256 checksum
How to use checksums
77b924b739c3b3de366e8a1317b9e923387b749d885342f1c49cb7355ba51b1e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.23 {"installer":{"name":"uv","version":"0.12.23","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}

Release history Release notifications | RSS feed

This release

0.0.10 This release

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.0

2 release files

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