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

Uploaded Python 3

File details

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

File metadata

  • Download URL: without_web-0.0.2.tar.gz
  • Upload date:
  • Size: 27.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","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.2.tar.gz
Algorithm Hash digest
SHA256 03cf6e321592074492e67e50a9f05525ea4a661d5331ed47009d355e1f4edbd8
MD5 14cd2c8a5ee38ba9c89682eeac55b54e
BLAKE2b-256 82d4148d977b72af0df843bbd6a8025291fd75e3f90d9e73d5356829f87cf2e9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: without_web-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 32.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b127966cef30a2678c792d77cee3c99fbc40f488b799867a18b967b0a82eea2a
MD5 34a3a3ad41734ecd54670507f957aa55
BLAKE2b-256 20b59e8f471632334f722d22f3b4678f749342fb1536b1fcfcb4ec9d4b675e83

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