Cleaner and non-deprecated typing for template app module. Avoids ruff errors with strict configurations.

This commit is contained in:
2026-08-31 20:14:39 +00:00
parent 8774224545
commit 475a2cdc3c
2 changed files with 4 additions and 4 deletions
+1 -1
View File
@@ -166,7 +166,7 @@ frontend = Frontend(Path(__file__).with_name("frontend-build"))
# Lifespan block for patching apps that don't have one # Lifespan block for patching apps that don't have one
LIFESPAN_BLOCK = """ LIFESPAN_BLOCK = """
@asynccontextmanager @asynccontextmanager
async def lifespan(app: FastAPI): async def lifespan(_app: FastAPI):
\"\"\"Manage app startup and shutdown resources.\"\"\" \"\"\"Manage app startup and shutdown resources.\"\"\"
await frontend.load() await frontend.load()
yield yield
+3 -3
View File
@@ -1,6 +1,6 @@
"""FastAPI application module with Vue frontend integration.""" """FastAPI application module with Vue frontend integration."""
from collections.abc import AsyncIterator from collections.abc import AsyncGenerator
from contextlib import asynccontextmanager from contextlib import asynccontextmanager
from pathlib import Path from pathlib import Path
@@ -13,7 +13,7 @@ frontend = Frontend(Path(__file__).with_name("frontend-build"))
@asynccontextmanager @asynccontextmanager
async def lifespan(_app: FastAPI) -> AsyncIterator[None]: async def lifespan(_app: FastAPI) -> AsyncGenerator:
"""Manage app startup and shutdown resources.""" """Manage app startup and shutdown resources."""
await frontend.load() await frontend.load()
yield yield
@@ -27,7 +27,7 @@ app = FastAPI(title="PROJECT_TITLE", debug=DEVMODE, lifespan=lifespan)
# Health check endpoint for the Vue demo app to verify the backend is running # Health check endpoint for the Vue demo app to verify the backend is running
@app.get("/api/health") @app.get("/api/health")
async def health_check() -> dict[str, str]: async def health_check() -> dict:
"""Return backend status for health monitoring.""" """Return backend status for health monitoring."""
return {"status": "ok"} return {"status": "ok"}