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

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

Built distribution (wheel)

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

Total release size: 41.1 kB

Release files / without_html-0.0.5.tar.gz

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

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

0.0.7

2 release files

0.0.6

2 release files

This release

0.0.5 This release

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