potiuk edited a comment on issue #19891:
URL: https://github.com/apache/airflow/issues/19891#issuecomment-983577261
> @potiuk does it sound reasonable or shall I use pre-commit run mypy ...
(which I did try but didnt get list and didnt look into it too much TBH)
I think it's better to do it inside `breeze` because there you have ALL
dependencies installed in the latest "constraints-main" versions - so you are
100% sure that you have the same dependencies. The problem is that mypy will
show different errors depending whcih dependencies you have installed (because
for example some dependency might have added type hinting in a different
version). This is why at least `./breeze` is recommended as "common" execution
environment for tests and static checks like mypy and flake (that's the main
purpose of Breeze anyway).
You do not have to run pre-commits. But at least emulating what they do is
useful.
Precommits under the hood do this (at least for the `airflow` test - the
namespace packages are not used for chart and docs - because they got brokent
if they do)
```
mypy --namespace-packages file file file ...
```
I am not 100% sure if just providing a package (as you did) will yield the
same results. I think in this case `mypy` will only check "published" objectsi
in `__init__.py` or something similar (but here I am not sure)
We used to do it (we converted files to packages) to overcome mypy's poor
support of namespace packages in 0.770, and by seing that after ~3 weeks we
have 992 errors that I see now with mypy 0.990 I am afraid part of the problem
was that we used packages rather than files. But I am not at all sure of it -
those might be simply because mypy 0.990 has gotten so much better since (this
is quite possible as 0.770 is > 1 year old)/
You can check if it is the case now and let me know if you have different
results if you try `package` vs. `modules` approach)
So at least check if when you do `mypy --namespace-packages test` and `find
test | xargs mypy --namespace-packages` in ./breeze, you get the same results.
My "hunch" is that they will differ. But if you enter breeze and run `find
test | xargs mypy --namespace-packages` - this is what `pre-commit` actually
does.
--
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]