potiuk opened a new pull request, #65492: URL: https://github.com/apache/airflow/pull/65492
## Summary Every non-provider mypy prek hook now lives in its own distribution's `.pre-commit-config.yaml`, runs in a dedicated virtualenv at `.build/mypy-venvs/<hook>/` with a dedicated mypy cache at `.build/mypy-caches/<hook>/`, and installs everything (including mypy itself) from the workspace `uv.lock` via a per-distribution `mypy` dep group — no more shared `.venv`, no more ephemeral `--with` overlays. ## What's new - **Coverage** — adds mypy hooks for the non-provider directories that were previously uncovered: `airflow-ctl-tests`, `helm-tests`, `airflow-e2e-tests`, `task-sdk-integration-tests`, `docker-tests`, `kubernetes-tests`, plus one `mypy-shared-<dist>` hook per `shared/<dist>` workspace member (13 total). Each hook lives in its distribution's own `.pre-commit-config.yaml` — prek auto-discovers nested configs. - **Split `mypy-dev` and `mypy-scripts`** — each has its own independent hook, its own dedicated venv, and its own `pyproject.toml`-level `[tool.mypy]` configuration. The script passes `--config-file <project>/pyproject.toml` for these two so their config takes precedence over the root one. - **Mypy installed from the frozen lock** — every distribution with a mypy hook declares `mypy = ["apache-airflow-devel-common[mypy]"]` in its `[dependency-groups]`. The script syncs and runs mypy with `--frozen --group mypy`, so mypy itself, its plugins, and its stubs all resolve against the main workspace `uv.lock`. - **`--follow-imports=silent`** — each hook only reports errors for files it owns; transitive code is covered by its own hook, avoiding divergent results across venvs on shared code. - **`breeze down --cleanup-mypy-cache`** — also wipes `.build/mypy-venvs/` and `.build/mypy-caches/` alongside the existing `.mypy_cache` and `mypy-cache-volume`. - **Selective-checks** — emits the right `skip-prek-hooks` set for every new hook, enumerating `shared/<dist>` dists at runtime so no hand-maintenance is needed. - **Enforcement** — a new `check-shared-mypy-hooks` prek hook fails when a `shared/<dist>` workspace member is missing its dedicated `.pre-commit-config.yaml`, printing the exact YAML to paste. Contributing docs describe the two-step process for adding a new shared library. ## Type-error fixes Pre-existing type errors surfaced by the newly added and cleaned-up checks are addressed: platform-specific ignores for Linux-only `os.posix_fadvise`, narrower types and `# type: ignore` markers in shared `configuration` / `observability` / `timezones` / `secrets_backend` / `secrets_masker`, Liskov override markers on the `AirflowConfigParser` subclass methods, and small correctness fixes in `dev/breeze` and the `docker-tests` / `kubernetes-tests` helpers. The full non-provider mypy suite now runs clean. --- ##### Was generative AI tooling used to co-author this PR? - [X] Yes — Claude Code (claude-opus-4-7) Generated-by: Claude Code (claude-opus-4-7) following [the guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
