Skip to main content

without-web

An opinionated HTTP and WebSocket router for without-asgi. without-asgi deliberately ships no router, only the unopinionated boundary and composition tools. without-web is the opinionated layer on top: t-string patterns with typed parameters, typed request extraction, 405-vs-404, mounting, scoped middleware, exception handlers, reverse routing (url_for), and OpenAPI.

It snaps onto the boundary through nothing but the existing HttpRouter type: Router.dispatch is an HttpRouter[T], so make_asgi_app(http=router.dispatch) just works, and bring-your-own (or no router at all) stays first-class.

import json

from without_asgi import Response, make_asgi_app
from without_web import INT, Router, get, path_param

uid = path_param("id", INT)  # one token: a pattern segment AND a typed read


@get(t"/users/{uid}", uid)  # t-string pattern; `@get` returns a Route value
async def show_user(state, user_id: int):  # user_id is an int, no `assert isinstance`
    body = json.dumps({"id": user_id}).encode()
    return Response(status=200, headers=((b"content-type", b"application/json"),), body=body)


router = Router(routes=(show_user,), fallback=not_found)
app = make_asgi_app(lifespan, http=router.dispatch)

Matching is a pure walk of an immutable trie, so precedence, 405-vs-404, and mounting fall out of the structure. Converters and extractors parse, they don't validate: a path param arrives already typed, and OpenAPI is a merge of the self-descriptions each layer recovers from structure rather than a blob declared by hand. Encoding stays the app's choice, so the router ships no json_response-style helper.

See the without-web guide (with the API reference) for the full surface: patterns, extractors, streaming input, mounting, middleware, exception handlers, reverse routing, OpenAPI, and WebSocket routing.

Download files

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

Source Distribution

without_web-0.0.3.tar.gz (27.7 kB view details)

Uploaded Source

Built Distribution

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

without_web-0.0.3-py3-none-any.whl (32.9 kB view details)

Uploaded Python 3

File details

Details for the file without_web-0.0.3.tar.gz.

File metadata

  • Download URL: without_web-0.0.3.tar.gz
  • Upload date:
  • Size: 27.7 kB
  • Tags: Source
  • Uploaded using 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}

File hashes

Hashes for without_web-0.0.3.tar.gz
Algorithm Hash digest
SHA256 29a1e70f775cf6e370e6f8fd2b138dd17a61546e3b2992c28cc2a51bd0906794
MD5 c5bb4557197830d52ef9590e160d21dd
BLAKE2b-256 bae4b3b7182c2e40ff4118196a33cfc8512940be1c2b278e36d7178fc8f75fb2

See more details on using hashes here.

File details

Details for the file without_web-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: without_web-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 32.9 kB
  • Tags: Python 3
  • Uploaded using 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}

File hashes

Hashes for without_web-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 868c538842490170dc444ad7fdda92b537976421903b9f32fe6858c84e3e42d0
MD5 4b01926f1017f5ef5caebdf75640f80d
BLAKE2b-256 61d7406cc106e2888eb0a9a6fdb21105b1089d388e2d4fb0518afb90e09ee673

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 Sentry Error logging StatusPage Status page