Run static analysis on backend code. Import check catches most errors, mypy for deeper type checking.
Run static analysis after making Python code changes to catch errors before running the server.
Invoke with /lint after editing Python files.
After editing Python files, verify they import correctly:
cd src/backend && .venv/Scripts/python.exe -c "from app.main import app"
This catches:
BackgroundTasks)For deeper type checking on specific files:
cd src/backend && .venv/Scripts/python.exe -m mypy app/routers/projects.py --ignore-missing-imports
Or check all routers:
cd src/backend && .venv/Scripts/python.exe -m mypy app/routers/ --ignore-missing-imports
mypy catches:
| Error Type | Example | Tool |
|---|---|---|
| Missing import | BackgroundTasks not imported | Import check |
| Undefined name | clip.get() on sqlite3.Row | Import check |
| Wrong parameter count | SQL with 2 ? but 1 param | mypy |
| Type mismatch | Passing str where int expected | mypy |
After making code changes to Python files, ALWAYS run:
cd src/backend && .venv/Scripts/python.exe -c "from app.main import app"
This imports the entire app and catches most issues before the user tries to start the server.