"""How a route reaches the store. Built once by the app's factory and parked on `app.state`; a route asks for it as a dependency rather than closing over it, the same split newsdesk's `web/deps.py` makes and for the same reason — a router module stays importable, and testable, on its own. Not a `yield` dependency: `Store` holds no connection between calls (see `app/storage/store.py`), so there is nothing to close, and building one per request would take SQLite's write lock for a plain read. """ from __future__ import annotations from typing import Annotated from fastapi import Depends from starlette.requests import HTTPConnection from app.config import Config from app.storage import Store def get_store(request: HTTPConnection) -> Store: return request.app.state.store StoreDep = Annotated[Store, Depends(get_store)] def get_config(request: HTTPConnection) -> Config: return request.app.state.config ConfigDep = Annotated[Config, Depends(get_config)]