jscheffl commented on code in PR #64780:
URL: https://github.com/apache/airflow/pull/64780#discussion_r3040527086
##########
contributing-docs/08_static_code_checks.rst:
##########
@@ -279,41 +280,48 @@ them manually by running ``prek --stage manual
<hook-id>``.
Mypy checks
-----------
-When we run mypy checks locally when pushing a change to PR, the ``mypy-*``
checks is run, ``mypy-airflow``,
-``mypy-dev``, ``mypy-providers``, ``mypy-airflow-ctl``, depending on the files
you are changing. The mypy checks
-are run by passing those changed files to mypy. This is way faster than
running checks for all files (even
-if mypy cache is used - especially when you change a file in Airflow core that
is imported and used by many
-files). You also need to have ``breeze ci-image build --python 3.10`` built
locally to run the mypy checks.
+When we run mypy checks locally, the ``mypy-*`` checks run depending on the
files you are changing:
+``mypy-airflow-core``, ``mypy-dev``, ``mypy-providers``, ``mypy-task-sdk``,
``mypy-airflow-ctl``, etc.
+The mypy checks are run by passing changed files to mypy. This is way faster
than running checks for all
+files (even if mypy cache is used - especially when you change a file in
Airflow core that is imported
+and used by many files).
-However, in some cases, it produces different results than when running checks
for the whole set
-of files, because ``mypy`` does not even know that some types are defined in
other files and it might not
-be able to follow imports properly if they are dynamic. Therefore in CI we run
``mypy`` check for whole
-directories (``airflow`` - excluding providers, ``providers``, ``dev`` and
``docs``) to make sure
-that we catch all ``mypy`` errors - so you can experience different results
when running mypy locally and
-in CI. If you want to run mypy checks for all files locally, you can do it by
running the following
-command (example for ``airflow`` files):
+For **non-provider projects** (airflow-core, task-sdk, airflow-ctl, dev,
scripts, devel-common), mypy
+runs locally using the ``uv`` virtualenv — no breeze CI image is needed. These
checks run in the
+``pre-commit`` stage, so they execute automatically on every commit. You can
also run them directly:
.. code-block:: bash
- prek --stage manual mypy-<FOLDER> --all-files
+ uv run --project <PROJECT> --with "apache-airflow-devel-common[mypy]" mypy
path/to/code
-For example:
+For **providers**, mypy still runs via breeze (``breeze run mypy``) and
requires
+``breeze ci-image build --python 3.10`` to be built locally.
+
+However, in some cases, running mypy on individual files produces different
results than when running
+checks for the whole set of files, because ``mypy`` does not even know that
some types are defined in
+other files and it might not be able to follow imports properly if they are
dynamic. Therefore in CI we
+run ``mypy`` check for whole directories (``airflow-core``, ``providers``,
``dev``, ``task-sdk``,
+``airflow-ctl``, etc.) to make sure that we catch all ``mypy`` errors — so you
can experience different
+results when running mypy locally and in CI. If you want to run mypy checks
for all files locally, you
+can do it by running the following command (example for ``airflow-core``
files):
.. code-block:: bash
- prek --stage manual mypy-airflow --all-files
+ prek --stage manual mypy-airflow-core --all-files
Review Comment:
Stage manual is not needed anymore?
```suggestion
prek mypy-airflow-core --all-files
```
Same below...
--
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]