patx/wred
Make Weft optional via server extra and refresh documentation
Commit 09052e9 · patx · 2026-10-18T19:47:11-04:00
Comments
No comments yet.
Diff
diff --git a/README.md b/README.md
index 56ff83d..f0b7d58 100644
--- a/README.md
+++ b/README.md
@@ -10,7 +10,7 @@ Your API needs to return some JSON. It probably doesn't need a goddamn cathedral
- Headers, query parameters, cached body reads, and JSON parsing.
- JSON responses and custom response tuples.
- Callable ASGI response support and routing relative to mounted paths.
-- Depends on `weft-server` and `orjson`. You can use any ASGI server.
+- Depends on only `orjson`. You can use any ASGI server you wish.
## What you don't get
@@ -43,12 +43,15 @@ async def hello(request):
return {'hello': 'world'}
```
-Run it with Weft, or any other ASGI server you like:
+To run it with Weft, install the optional `server` extra:
```bash
+pip install 'wred[server]'
weft app:app
```
+You can also install and use any other ASGI server you like.
+
Open <http://127.0.0.1:8000>. Wred is HTTP-only.
Unsupported protocols raise `RuntimeError` without sending HTTP messages,
following [ASGI guidance](https://asgi.readthedocs.io/en/latest/specs/main.html#protocol-specifications).
@@ -208,10 +211,12 @@ the server without Wred attempting a second response.
Since there isn't much to Wred, it's really fast. What it lacks in features it gains in speed.
-Wred running on Weft with 8 workers achieved up to 561,103 requests/second, with a median
-of 549,344 requests/second across four runs. Average p99 latency was 3.65 ms, with
+Wred running on Peregrine 1.1.7 with 8 workers, ASGI, and uvloop
+achieved up to 646,979 requests/second, with a median of 622,399 requests/second
+across four runs on October 18, 2026. Average p99 latency across runs was 3.92 ms, with
zero socket errors or non-success responses. Testing used `wrk` with 4 threads, 256 concurrent
-connections, and 20-second runs on a Dell XPS 13 9350 with an Intel Core Ultra 7 256V (8 cores,
+connections, and 20-second runs after a 5-second warmup for each run, using Python 3.14.4
+on a Dell XPS 13 9350 with an Intel Core Ultra 7 256V (8 cores,
up to 4.8 GHz), running Ubuntu 26.04.1 LTS (Linux 6.17.0-1023-oem, x86-64).
With respect to the lack of features mentioned above, Wred is meant to be bare bones, it's really
diff --git a/docs/README.md b/docs/README.md
index ca09b69..f891645 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -1,4 +1,6 @@
-# [Wred](https://harrisonerd.com/wred) is a tiny and fast Python backend for JavaScript web apps. View the documentation and source [here](https://gitman.io/patx/wred).
+[](https://harrisonerd.com/wred)
+
+[Wred](https://harrisonerd.com/wred) is a tiny and fast Python backend for JavaScript web apps. View the documentation and source [here](https://gitman.io/patx/wred).
## Installation
@@ -6,6 +8,9 @@
$ pip install wred
```
+Only `orjson` is required. To include the optional Weft ASGI server, use
+`pip install 'wred[server]'`. You can also install and use another ASGI server.
+
## Quick Start
```python
@@ -17,15 +22,3 @@ app = App()
async def index(request):
return {"hello": "world"}
```
-
-## Serving the frontend
-
-Use whatever you want to serve your frontend. Wred works with ASGI middleware
-such as ServeStatic, Starlette's
-[`FileResponse`](https://starlette.dev/responses/#fileresponse) and
-[`StaticFiles`](https://starlette.dev/staticfiles/), web servers such as Caddy,
-frontend dev servers such as Vite, and other hosting or build tools. These are
-options, not requirements.
-See the [frontend serving examples](https://gitman.io/patx/wred#serving-the-frontend)
-in the full README. The notebook example uses PyMongo and ServeStatic as its
-own dependencies.
diff --git a/docs/index.html b/docs/index.html
index 427194e..89c280a 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -45,13 +45,8 @@ app = App()
@app.route("/")
async def index(request):
return {"hello": "world"}
-
-# run with `weft app:app`
</code></pre>
</section>
</main>
- <footer>
- <a href="https://harrisonerd.com">© 2026 Harrison Erd</a>
- </footer>
</body>
</html>
diff --git a/example_app/asgi.py b/example_app/asgi.py
index 6061506..afe95b0 100644
--- a/example_app/asgi.py
+++ b/example_app/asgi.py
@@ -5,7 +5,7 @@
Run the notebook demo with MongoDB listening on localhost:27017::
- python -m pip install -e . pymongo servestatic
+ python -m pip install -e '.[server]' pymongo servestatic
weft example_app.asgi:app
Open http://127.0.0.1:8000. MongoDB preserves accounts, sessions,
diff --git a/pyproject.toml b/pyproject.toml
index 14d6eb4..bb9b95d 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -11,7 +11,10 @@ requires-python = ">=3.11"
license = "BSD-3-Clause"
license-files = ["LICENSE"]
authors = [{ name = "Harrison Erd", email = "[email protected]" }]
-dependencies = ["orjson", "weft-server"]
+dependencies = ["orjson"]
+
+[project.optional-dependencies]
+server = ["weft-server"]
[project.urls]
Homepage = "https://harrisonerd.com/wred"
diff --git a/wred.py b/wred.py
index 573e86f..84bcaf0 100644
--- a/wred.py
+++ b/wred.py
@@ -5,7 +5,7 @@ ASGI-compatible web services. It prioritizes simplicity and performance over all
Copyright (c) 2026, Harrison Erd.
"""
__author__, __email__, __license__ = 'Harrison Erd', '[email protected]', 'BSD-3-Clause'
-__version__ = '0.08'
+__version__ = '0.09'
from collections.abc import Awaitable, Callable
from functools import cached_property
from typing import Any