ci: add mypy job + pre-commit hook, tighten type annotations

- .github/workflows/ci.yml: new 'types' job runs mypy src/; docker now needs lint+types+test
- .pre-commit-config.yaml: add mirrors-mypy hook on src/ with types-requests, types-PyYAML
- pyproject.toml: add per-module overrides ignoring legacy modules (main, downloader, reddit_client, database, extractors.{reddit,gfycat}) while keeping src/web/ strict
- src/web/deps.py: type DOWNLOADS_DIR explicitly as Path
- src/web/config_manager.py: type guards on get_subreddits/users/blacklist returns
- src/web/routers/favorites.py: dict[str, object] for result, avoid in-place + on object
- src/web/routers/media.py: dict[str, object] for delete result
- src/web/rate_limit.py: move Awaitable/Callable under TYPE_CHECKING
- ruff format + auto-fix on src/ + tests/
This commit is contained in:
authentik Default Admin 2026-05-17 11:58:40 +01:00
parent 34c2b16e19
commit b4a2f303ac
12 changed files with 63 additions and 25 deletions

View file

@ -15,8 +15,18 @@ jobs:
with:
python-version: "3.12"
- run: pip install ruff
- run: ruff check src/
- run: ruff format --check src/
- run: ruff check src/ tests/
- run: ruff format --check src/ tests/
types:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- run: pip install -e ".[dev]"
- run: mypy src/
test:
runs-on: ubuntu-latest
@ -30,7 +40,7 @@ jobs:
docker:
runs-on: ubuntu-latest
needs: [lint, test]
needs: [lint, types, test]
steps:
- uses: actions/checkout@v4
- run: docker build -t reddit-media-collector .