Files
responder/README.md
T
kennethreitz 0cbcaf9c4f Code quality improvements and test fixes (#592)
## Summary
Comprehensive post-v3.0.0 modernization: new features, bug fixes,
dependency cleanup, docs, and test coverage.

**New features:**
- **HTTP method filtering** — `@api.route("/data", methods=["GET"])`
- **Lifespan context manager** — modern async startup/shutdown
- **`api.exception_handler()`** — custom error handling per exception
type
- **`api.graphql()`** — one-liner GraphQL setup
- **`resp.file()`** — serve files from disk with auto content-type
- **before_request short-circuit** — set status code to skip route
handler
- **`req.path_params`** / **`req.client`** / **`req.is_json`** — new
request properties
- **`uuid`** and **`path`** route convertors
- **PEP 561 `py.typed`** marker

**Bug fixes:**
- Fix multipart parser losing headers
- Fix `url_for()` with typed params (`{id:int}`)
- Fix `resp.body` encoding crash on bytes content
- Fix Python 3.9 type syntax (`from __future__ import annotations`)
- Fix broken session test and no-op file upload test
- Fix helloworld example 404 on root path

**Dependencies:**
- Flattened — `pip install responder` gets everything
- Core: just starlette + uvicorn (down from 10 deps)

**Docs & README:**
- All new features documented in tour
- Modernized README features list
- Deployment guide: Docker, cloud, uvicorn
- Removed Pipenv, extras, stale references throughout

**Tests & quality:**
- 117 tests (up from 92), 91% coverage, 0 warnings
- CaseInsensitiveDict, GraphQL edge cases, staticfiles tests
- Ruff clean, all `tmpdir` → `tmp_path`

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-22 07:44:11 -04:00

4.4 KiB

Responder: a familiar HTTP Service Framework for Python

ci-tests ci-docs Documentation Status version license python-versions downloads contributors status

responder-synopsis

Responder is powered by Starlette. View documentation.

Responder gets you an ASGI app, with a production static files server pre-installed, Jinja templating, and a production webserver based on uvloop, automatically serving up requests with gzip compression. The async declaration within the example program is optional.

Testimonials

"Pleasantly very taken with python-responder. @kennethreitz at his absolute best." —Rudraksh M.K.

"ASGI is going to enable all sorts of new high-performance web services. It's awesome to see Responder starting to take advantage of that." — Tom Christie author of Django REST Framework

"I love that you are exploring new patterns. Go go go!" — Danny Greenfield, author of Two Scoops of Django

More Examples

See the documentation's feature tour for more details on features available in Responder.

Installing Responder

Install the most recent stable release:

pip install --upgrade responder

Alternatively, install directly from the repository:

pip install 'responder @ git+https://github.com/kennethreitz/responder.git'

Responder supports Python 3.9+.

The Basic Idea

The primary concept here is to bring the niceties from both Flask and Falcon and unify them into a single framework. You'll find a familiar API with a clean, Pythonic design.

  • Setting resp.text sends back unicode, while setting resp.html sends back HTML.
  • Setting resp.media sends back JSON/YAML (.text/.html/.content override this).
  • Setting resp.content sends back bytes.
  • Use resp.file("path") to serve files with automatic content-type detection.
  • Case-insensitive req.headers dict.
  • resp.status_code, req.method, req.url, and other familiar friends.

Features

  • Flask-style route expressions with f-string syntax and type convertors (str, int, float, uuid, path).
  • HTTP method filtering: @api.route("/data", methods=["GET"]).
  • Every request and response is passed into each view and mutated — including response.media for JSON/YAML content negotiation.
  • Built-in test client powered by Starlette's TestClient.
  • Mount other WSGI/ASGI apps at subroutes.
  • Automatic gzip compression.
  • Class-based views with on_get, on_post, on_request methods.
  • GraphQL support via Graphene with api.graphql().
  • OpenAPI schema generation with interactive docs.
  • Lifespan context managers for startup/shutdown.
  • Custom exception handlers.
  • Before-request hooks with short-circuit support.
  • Cookie-based sessions.
  • WebSocket support.
  • Background tasks.
  • Production uvicorn server built-in.

Development

See Development Sandbox.

Supported by

JetBrains logo.

Special thanks to the kind people at JetBrains s.r.o. for supporting us with excellent development tooling.