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

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

Built distribution (wheel)

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

Total release size: 41.2 kB

Release files / without_html-0.0.7.tar.gz

Download URL without_html-0.0.7.tar.gz
Size 19.4 kB
Tags Source
SHA-256 checksum
How to use checksums
9c3cd5c49d751e0bdc39fab5c00d6b305ef2d79af8c323bc66403026c0f3e832
BLAKE2b-256 checksum
How to use checksums
4ba08bbd99c4a8fcc9c332c51a90409544f96ecf21e5917a2461b942378f7795
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.7-py3-none-any.whl

Download URL without_html-0.0.7-py3-none-any.whl
Size 21.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5ee1d58cff9ca00dc7abf78ef9cae0ce33d15c1c96ae586f4ef65f4a9defb9e1
BLAKE2b-256 checksum
How to use checksums
03c841095b7f3705ae71100c83e185248da3120ba9228ab64edf05df001a6c71
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

0.0.8

2 release files

This release

0.0.7 This release

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