Skip to content

[v3-2-test] Run non-provider mypy checks as regular prek static check…#64810

Merged
potiuk merged 1 commit into
apache:v3-2-testfrom
potiuk:backport-0ce1dd7-v3-2-test
Apr 6, 2026
Merged

[v3-2-test] Run non-provider mypy checks as regular prek static check…#64810
potiuk merged 1 commit into
apache:v3-2-testfrom
potiuk:backport-0ce1dd7-v3-2-test

Conversation

@potiuk

@potiuk potiuk commented Apr 6, 2026

Copy link
Copy Markdown
Member

…s instead of separate CI jobs (#64780)

Non-provider mypy checks (airflow-core, task-sdk, airflow-ctl, dev, scripts, devel-common) now run locally via uv as regular prek hooks in the pre-commit stage, instead of running as separate mypy CI jobs in the CI image checks workflow. This means they run as part of the regular static checks job in CI and automatically on every local commit.

The folder-level mypy checks (which check entire directories at once for comprehensive cross-file type checking) replace the previous file-level incremental checks.

Provider mypy checks still run via breeze as a dedicated CI job, now embedded directly in the main CI workflow (ci-amd-arm.yml) instead of being dispatched through the ci-image-checks reusable workflow.

The selective checks logic skips non-provider mypy hooks when their relevant files haven't changed, unless devel-common/pyproject.toml changes on main (which affects all mypy configurations).
(cherry picked from commit 0ce1dd7)


Was generative AI tooling used to co-author this PR?
  • Yes (please specify the tool below)

  • Read the Pull Request Guidelines for more information. Note: commit author/co-author name and email in commits become permanently public when merged.
  • For fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
  • When adding dependency, check compliance with the ASF 3rd Party License Policy.
  • For significant user-facing changes create newsfragment: {pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.

…s instead of separate CI jobs (apache#64780)

Non-provider mypy checks (airflow-core, task-sdk, airflow-ctl, dev, scripts,
devel-common) now run locally via uv as regular prek hooks in the pre-commit
stage, instead of running as separate mypy CI jobs in the CI image checks
workflow. This means they run as part of the regular static checks job in CI
and automatically on every local commit.

The folder-level mypy checks (which check entire directories at once for
comprehensive cross-file type checking) replace the previous file-level
incremental checks.

Provider mypy checks still run via breeze as a dedicated CI job, now embedded
directly in the main CI workflow (ci-amd-arm.yml) instead of being dispatched
through the ci-image-checks reusable workflow.

The selective checks logic skips non-provider mypy hooks when their relevant
files haven't changed, unless devel-common/pyproject.toml changes on main
(which affects all mypy configurations).
(cherry picked from commit 0ce1dd7)

Co-authored-by: Jarek Potiuk <jarek@potiuk.com>
@potiuk potiuk merged commit 4e06847 into apache:v3-2-test Apr 6, 2026
88 of 89 checks passed
@potiuk potiuk deleted the backport-0ce1dd7-v3-2-test branch April 6, 2026 21:16
@github-project-automation github-project-automation Bot moved this from Backlog to Done in Airflow Registry Apr 6, 2026
@Dev-iL

Dev-iL commented Apr 6, 2026

Copy link
Copy Markdown
Collaborator

Couple of questions:

  1. Runtime-wise, what is the impact on local hook duration?
  2. Coverage-wise, how does the folder-level strategy compare to the file-level one?

@jscheffl

jscheffl commented Apr 6, 2026

Copy link
Copy Markdown
Contributor

@potiuk At least on another PR without changes in Python mypy is now complianing: https://github.com/apache/airflow/actions/runs/24052602891/job/70154231167?pr=64811 - did this backport broke the v3-2-test branch? Or was it broken before?

@potiuk

potiuk commented Apr 8, 2026

Copy link
Copy Markdown
Member Author

Couple of questions:
Runtime-wise, what is the impact on local hook duration?

Definitely the image build time - or even checking if it needs rebuild - many times people do not have latest image and that requires waiting for the build. The mypy itself depends on docker runtime - on the default Docker Desktop - there are few seconds overhead.

Coverage-wise, how does the folder-level strategy compare to the file-level one?

Stability is much higher. When you run mypy on individual files you might get different results.

@jscheffl

@potiuk At least on another PR without changes in Python mypy is now complianing:
https://github.com/apache/airflow/actions/runs/24052602891/job/70154231167?pr=64811 - did this backport broke the v3-2-test branch? Or was it broken before?

I don't think it's related, it has been running old approach. I did not see similar issues.

vatsrahul1001 pushed a commit that referenced this pull request Apr 8, 2026
…s instead of separate CI jobs (#64780) (#64810)

Non-provider mypy checks (airflow-core, task-sdk, airflow-ctl, dev, scripts,
devel-common) now run locally via uv as regular prek hooks in the pre-commit
stage, instead of running as separate mypy CI jobs in the CI image checks
workflow. This means they run as part of the regular static checks job in CI
and automatically on every local commit.

The folder-level mypy checks (which check entire directories at once for
comprehensive cross-file type checking) replace the previous file-level
incremental checks.

Provider mypy checks still run via breeze as a dedicated CI job, now embedded
directly in the main CI workflow (ci-amd-arm.yml) instead of being dispatched
through the ci-image-checks reusable workflow.

The selective checks logic skips non-provider mypy hooks when their relevant
files haven't changed, unless devel-common/pyproject.toml changes on main
(which affects all mypy configurations).
(cherry picked from commit 0ce1dd7)
@potiuk

potiuk commented Apr 8, 2026

Copy link
Copy Markdown
Member Author

@Dev-iL

  1. airflow-core in Breeze image (MacOS regular Docker Engine):

Clear cache (38s):

[Breeze:3.10.20] root@ff650e373426:/opt/airflow$ time mypy @/files/mypy_files.txt
Success: no issues found in 1095 source files

real	0m38.061s
user	0m30.375s
sys	0m5.214s
[Breeze:3.10.20] root@ff650e373426:/opt/airflow$

Full cache (2.79s):

[Breeze:3.10.20] root@ff650e373426:/opt/airflow$ time mypy @/files/mypy_files.txt
Success: no issues found in 1095 source files

real	0m2.795s
user	0m1.216s
sys	0m1.080s
  1. Local

Clear cache (10.82 s):

time uv run --python 3.10 --project airflow-core --with "apache-airflow-devel-common[mypy]" mypy @files/mypy_files.txt
Success: no issues found in 1095 source files
uv run --python 3.10 --project airflow-core --with  mypy @files/mypy_files.txt  10.82s user 0.92s system 94% cpu 12.484 total

Full cache (0.44s):

time uv run --python 3.10 --project airflow-core --with "apache-airflow-devel-common[mypy]" mypy @files/mypy_files.txt
Success: no issues found in 1095 source files
uv run --python 3.10 --project airflow-core --with  mypy @files/mypy_files.tx  0.44s user 0.26s system 49% cpu 1.432 total

vatsrahul1001 pushed a commit that referenced this pull request Apr 15, 2026
…s instead of separate CI jobs (#64780) (#64810)

Non-provider mypy checks (airflow-core, task-sdk, airflow-ctl, dev, scripts,
devel-common) now run locally via uv as regular prek hooks in the pre-commit
stage, instead of running as separate mypy CI jobs in the CI image checks
workflow. This means they run as part of the regular static checks job in CI
and automatically on every local commit.

The folder-level mypy checks (which check entire directories at once for
comprehensive cross-file type checking) replace the previous file-level
incremental checks.

Provider mypy checks still run via breeze as a dedicated CI job, now embedded
directly in the main CI workflow (ci-amd-arm.yml) instead of being dispatched
through the ci-image-checks reusable workflow.

The selective checks logic skips non-provider mypy hooks when their relevant
files haven't changed, unless devel-common/pyproject.toml changes on main
(which affects all mypy configurations).
(cherry picked from commit 0ce1dd7)
@vatsrahul1001 vatsrahul1001 added the changelog:skip Changes that should be skipped from the changelog (CI, tests, etc..) label Apr 15, 2026
@vatsrahul1001 vatsrahul1001 added this to the Airflow 3.2.1 milestone Apr 15, 2026
vatsrahul1001 pushed a commit that referenced this pull request Apr 15, 2026
…s instead of separate CI jobs (#64780) (#64810)

Non-provider mypy checks (airflow-core, task-sdk, airflow-ctl, dev, scripts,
devel-common) now run locally via uv as regular prek hooks in the pre-commit
stage, instead of running as separate mypy CI jobs in the CI image checks
workflow. This means they run as part of the regular static checks job in CI
and automatically on every local commit.

The folder-level mypy checks (which check entire directories at once for
comprehensive cross-file type checking) replace the previous file-level
incremental checks.

Provider mypy checks still run via breeze as a dedicated CI job, now embedded
directly in the main CI workflow (ci-amd-arm.yml) instead of being dispatched
through the ci-image-checks reusable workflow.

The selective checks logic skips non-provider mypy hooks when their relevant
files haven't changed, unless devel-common/pyproject.toml changes on main
(which affects all mypy configurations).
(cherry picked from commit 0ce1dd7)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:airflow-ctl area:dev-tools area:logging area:registry area:task-sdk changelog:skip Changes that should be skipped from the changelog (CI, tests, etc..)

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants