New features:
- Request ID: api = responder.API(request_id=True)
- Rate limiting: RateLimiter(requests=100, period=60).install(api)
- MessagePack format: await req.media("msgpack")
- All new features documented in tour
176 tests, 95% coverage.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Five new features:
1. **Pydantic auto-validation** — if request_model is set, request
bodies are validated automatically and 422 returned on failure.
If response_model is set, resp.media is serialized through the
model (extra fields stripped, types enforced).
2. **Server-Sent Events** — resp.sse for real-time streaming:
@resp.sse
async def stream():
yield {"event": "update", "data": "hello"}
3. **resp.stream_file()** — stream large files without loading
into memory, with automatic content-type detection.
4. **after_request hooks** — run code after every request:
@api.after_request()
def add_request_id(req, resp):
resp.headers["X-Request-ID"] = str(uuid.uuid4())
5. **Route groups** — organize routes with shared prefixes:
v1 = api.group("/v1")
@v1.route("/users")
def list_users(req, resp): ...
Also fix streaming responses not sending Content-Type headers.
172 tests, 95% coverage.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Define your API schemas with Pydantic models instead of (or alongside)
YAML docstrings and marshmallow:
from pydantic import BaseModel
class PetIn(BaseModel):
name: str
age: int = 0
class PetOut(BaseModel):
id: int
name: str
age: int
@api.route("/pets", methods=["POST"],
request_model=PetIn, response_model=PetOut)
async def create_pet(req, resp):
data = await req.media()
resp.media = {"id": 1, **data}
Also works with @api.schema("Name") decorator for registering
standalone schema components.
Pydantic models, marshmallow schemas, and YAML docstrings can all
be used together in the same API.
Also: rewrite docs with more prose, restore sidebar logo and links,
add FastAPI acknowledgment, update homepage copy.
161 tests, 95% coverage.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Remove commented-out tests (route overlap, form data, file uploads)
- Remove stale TODO/FIXME comments from routes.py and api.py
- Make CLI npm error assertions case-insensitive and more flexible
to handle different npm versions across CI environments
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace with stdlib urllib.request. No third-party HTTP client
needed for test probing.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Bump version to 3.0.0
- Replace deprecated starlette.middleware.wsgi with a2wsgi
- Pin starlette[full]>=0.40, add a2wsgi dependency
- Bump minimum Python to 3.9, drop 3.7/3.8 support
- Remove whitenoise conditional (Python <3.8 no longer supported)
- Clean up CI matrix: drop old Python versions and OS exclusions
- Fix deprecated httpx TestClient usage in tests (data= -> content=, per-request cookies)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
## About
- Add Ruff configuration to `pyproject.toml`, apply its formatter, and
satisfy its linter.
- Migrate pytest configuration to `pyproject.toml`.
Increasing the coverage of api.py to 86%
- use pytest.parametrize to test cors and hsts parameters usage
- use pytest.parametrize to factorize test_staticfiles_custom_route
- add tests for path_matches_route and Route() with no endpoint
- test Jinja template rendering from a file
- remove _notfound_wsgi_app, before_ws_requests, before_http_requests
they didn't seem used anywhere and the before_* method were broken, referring to
self.before_requests that doesn't exist anymore