Fix template mypy errors and make CI mypy blocking - #28
Merged
Merged
Conversation
- Enable the pydantic mypy plugin so Settings() isn't flagged for fields BaseSettings reads from the environment - Type database_url as str (BaseSettings validates defaults, so build_db_url always produces a URL); behavior unchanged - Use async_sessionmaker instead of sessionmaker for the async engine - users.update_user: don't reuse `result` for the Role query, and assign a list to user.roles - get_permissions_for_apikey accepts str | UUID (str on SQLite, UUID on the TimescaleDB models) - Annotate JWT claims read with payload.get() as Optional[str] - Drop continue-on-error from the CI mypy step now that mypy is clean, so CI and the pre-commit hook agree Closes #25 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Sep 23, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #25.
main/devhad 15 mypy errors. That made the pre-commit mypy hook (added in #13) block every commit touchingapp/, while CI's mypy step was set tocontinue-on-error. This PR fixes all 15 and makes the CI step blocking, so the hook and CI agree.Changes
pyproject.tomlpydantic.mypyplugin, soSettings()isn't flagged for fieldsBaseSettingsreads from the environment (5 errors)app/config.pydatabase_url: str = ""instead ofOptional[str] = None.BaseSettingsvalidates defaults, sobuild_db_urlalways produces a URL. Checked: same result with and withoutDATABASE_URLsetapp/db/session.pyasync_sessionmakerinstead ofsessionmakerfor the async engine (the SQLAlchemy 2.0 API; same call interface)app/db/users.pyresultfor the Role query, which caused the reportedUser.nameerror; that one wasn't a real bug. Assign alisttouser.rolesapp/db/apikeys.pyget_permissions_for_apikey(apikey_id: str | UUID):stron SQLite,UUIDwith the TimescaleDB modelsapp/deps.py,app/api/auth.pypayload.get()typedOptional[str].github/workflows/ci.ymlcontinue-on-errorfrom the mypy stepNo behavior changes.
Checks
alembic upgrade headon a fresh SQLite databaseOnce this is released, the OpenRVDAS branches get it with the next rebase.
openrvdas_devhas no other mypy errors left after #26.🤖 Generated with Claude Code