Refactor: split serve/server.py (3220 lines) into focused modules
serve/server.py is now 69 lines — app factory, middleware, and router
registration only.
New modules:
deps.py (168 lines) — module-level globals + auth dependency functions
models.py (85 lines) — all Pydantic request/response models
tasks.py (136 lines) — background workers and job tracker
routers/ — one file per domain (10 routers, ~2750 lines total)
auth.py, me.py, admin.py, activities.py, uploads.py,
segments.py, strava.py, garmin.py, ideas.py, feed.py
cli.py updated to set globals on deps instead of server.
88 new regression tests in tests/serve/ cover auth guards and key
behaviours for every router; 294 total passing after the split.
This commit is contained in:
+1
-1
@@ -491,7 +491,7 @@ def test_activity_geojson_missing_geometry(client, tmp_path, authenticated_sessi
|
||||
|---|---|---|
|
||||
| 1 | Extract shared image utilities → `bincio/shared/images.py` | Done |
|
||||
| 2 | Extract HTML template → `bincio/edit/templates/edit.html` | Done |
|
||||
| 3 | Split `serve/server.py` into `deps.py` + `routers/*` | Not started |
|
||||
| 3 | Split `serve/server.py` into `deps.py` + `routers/*` | Done |
|
||||
| 4 | Narrow broad `except Exception:` catches | Not started |
|
||||
|
||||
> **Note on dependency pinning**: not included. `uv.lock` already pins every dependency (including transitives) to exact versions, which is strictly stronger than switching `>=` to `~=` in `pyproject.toml`. The lockfile is the right mechanism for this concern.
|
||||
|
||||
Reference in New Issue
Block a user