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.8

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.8
File Size Uploaded
without_html-0.0.8.tar.gz 19.4 kB Details

Built distribution (wheel)

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

Total release size: 41.2 kB

Release files / without_html-0.0.8.tar.gz

Download URL without_html-0.0.8.tar.gz
Size 19.4 kB
Tags Source
SHA-256 checksum
How to use checksums
301afe07cc50ed6c15ec71067e98facd5779cdc933171d42e7a80946cb270453
BLAKE2b-256 checksum
How to use checksums
eccf824d551f266d940007b82bdc046acf9fa19b7f41af3ab137752d7ce4e5e9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.10 {"installer":{"name":"uv","version":"0.12.10","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.8-py3-none-any.whl

Download URL without_html-0.0.8-py3-none-any.whl
Size 21.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d5e15fbfdc8e02307b5a61fe031f3f0d6b77859079a66757c81b96b36d46eedf
BLAKE2b-256 checksum
How to use checksums
3dd64c1a7928beb4ca15a735d1710c227523e20d85a6f37c081d045c0a4cef55
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.10 {"installer":{"name":"uv","version":"0.12.10","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

0.0.9

2 release files

This release

0.0.8 This release

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