mirror of
https://github.com/kennethreitz/responder.git
synced 2026-06-05 14:50:19 +00:00
1c729c8542
## Summary - **Auth tutorial**: fix deprecated `datetime.utcnow()` → `datetime.now(timezone.utc)`, add role-based access control section, add auth strategy comparison guide - **WebSocket tutorial**: use `WebSocketDisconnect` instead of bare `Exception` in chat example, add connection lifecycle section with close codes, add rejected connection test example - **SQLAlchemy tutorial**: modernize from `Column()` to `mapped_column()` / `Mapped[]` (SQLAlchemy 2.0 style with type checker support) - **Deployment**: use `uv` in Docker example instead of pip, fix stale `uv.lock` reference in production checklist - **Quickstart**: link to all tutorials in "next steps" (was only linking to 3 of 9) - **Sandbox**: rewrite with project layout tree, mypy command, and pattern-matching test examples ## Test plan - [x] `make html` builds cleanly - [x] All 199 tests pass 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
63 lines
1.6 KiB
Markdown
63 lines
1.6 KiB
Markdown
(sandbox)=
|
|
# Development Sandbox
|
|
|
|
## Setup
|
|
|
|
Clone the repo and install all dependencies:
|
|
```shell
|
|
git clone https://github.com/kennethreitz/responder.git
|
|
cd responder
|
|
uv venv && source .venv/bin/activate
|
|
uv pip install --upgrade --editable '.[develop,docs,release,test]'
|
|
```
|
|
|
|
## Running Tests
|
|
```shell
|
|
pytest # full suite with coverage
|
|
pytest tests/test_responder.py -xvs # single file, stop on first failure
|
|
pytest -k "test_mount" # run tests matching a pattern
|
|
```
|
|
|
|
## Code Formatting
|
|
```shell
|
|
ruff format . # auto-format
|
|
ruff check --fix . # lint and auto-fix
|
|
```
|
|
|
|
## Type Checking
|
|
```shell
|
|
mypy
|
|
```
|
|
|
|
## Documentation
|
|
|
|
Live-reloading doc server (opens in browser):
|
|
```shell
|
|
cd docs
|
|
sphinx-autobuild --open-browser --watch source source build
|
|
```
|
|
|
|
Or build once:
|
|
```shell
|
|
cd docs
|
|
make html
|
|
# open build/html/index.html
|
|
```
|
|
|
|
## Project Layout
|
|
|
|
```
|
|
responder/
|
|
├── responder/ # main package
|
|
│ ├── api.py # API class — the entry point
|
|
│ ├── routes.py # Router, Route, WebSocketRoute
|
|
│ ├── models.py # Request and Response wrappers
|
|
│ ├── ext/ # extensions (CLI, GraphQL, OpenAPI, rate limiting)
|
|
│ ├── background.py # background task queue
|
|
│ └── formats.py # content negotiation (JSON, YAML, msgpack)
|
|
├── tests/ # pytest test suite
|
|
├── examples/ # runnable example apps
|
|
├── docs/source/ # Sphinx documentation
|
|
└── pyproject.toml # project metadata and tool config
|
|
```
|