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.4.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.4-py3-none-any.whl (32.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: without_web-0.0.4.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.4.tar.gz
Algorithm Hash digest
SHA256 37a052c9fcfe2b994d3a0774cea5882658205dc57f5cc9f96f87d4da1dcf1570
MD5 96effd19e86af277668220c42699261e
BLAKE2b-256 7213c5bbb54faa9ddac84254efa0d35f04b80a6991501566b3976b2a8daeae70

See more details on using hashes here.

File details

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

File metadata

  • Download URL: without_web-0.0.4-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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 ee37da8a97f0cdf1071d195f0d370166971fb2775b945ea0d218ec0573bac511
MD5 95ee4ff07ece53e5d42cc99a8c9ee940
BLAKE2b-256 7ec7a82c46b7c4f381677ee570d0e1b135ed29f94c1bbc01eb7cb6c406c9bc64

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