-
Notifications
You must be signed in to change notification settings - Fork 16.4k
Fix failing pre-commits after making 3.7 default #19334
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix failing pre-commits after making 3.7 default #19334
Conversation
|
This should fix the 2nd (and last widespread) failure in regular PRs after chaning 3.7 to be default :). |
|
Hmm. Seems like running current mypy with 3.7 ACTUALLY causes problems: |
|
All right - I feel like good opportunity to migrate to latest mypy 😱 . We had it fixed to 0.770 which was released 11th May 2020. Sounds like we are little behind. |
|
CC: @dstandish -> I am not sure how Many problems we will have now with moving mypy from 0.770 to 0.910, but imagine if every developer had their own version of mypy installation with their own versions of other dependencies in their own version of Python. This is is why running mypy in the same docker with the same python + the same dependencies is a very good option (even if it is slower on MacOS) :(. In this case just changing Image from 3.6 to 3.7 to run mypy caused: But I expect quite a number of new errors reported with newer version of Mypy. |
|
BTW. I am waiting (two weeks) for my new McBook Pro (Late 2021 - with
|
very exciting. and good luck to you 😅 |
|
The PR most likely needs to run full matrix of tests because it modifies parts of the core of Airflow. However, committers might decide to merge it quickly and take the risk. If they don't merge it quickly - please rebase it to the latest main at your convenience, or amend the last commit of the PR, and push it with --force-with-lease. |
|
Merging into #19333 |
|
We still need to fix some resulting mypy errors @uranusjr I am afraid :) |
|
Als this one is really separate from fixing the warnings (I will try to fix the mypy errors today unless someone bits me to it). |
|
I will not be near my PC whole day today - but maybe someone could simply comment out the failing mypy precommits temporarily until we fix it ? |
|
Added PR to remove mypy checks temporarily #19345 |
After we moved to Python 3.7 as default, it had a ripple effect that MyPy checks started failing. We aim to fix it permanently in apache#19334 but this needs a bit more changes, so for the moment we skip the checks.
After we moved to Python 3.7 as default, it had a ripple effect that MyPy checks started failing. We aim to fix it permanently in #19334 but this needs a bit more changes, so for the moment we skip the checks.
12fc0cf to
8a66ea0
Compare
8a66ea0 to
9f0c641
Compare
2a1bffe to
4fc4ef1
Compare
uranusjr
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Didn’t read everything but there are some things we can do a bit better
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don’t think this is supposed to fail?
airflow/cli/simple_table.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| output = tabulate(rows, tablefmt="plain", headers=list(data[0].keys())) | |
| output = tabulate(rows, tablefmt="plain", headers=list(data[0])) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can also just do
(run_id,) = (
session.query(TaskInstance.run_id)
...
.one()
)and let SQLAlchemy raise when there’s not a matching task instance found (it shouldn’t happen).
4fc4ef1 to
db2117a
Compare
Yeah. It's a draft - I want to make all the changes first and split it into a series of "targetted" PRs (otherwise it will be impossible to review) and re-enable mypy after I merge them all. |
db2117a to
ca641d7
Compare
This PR enables mypy back as pre-commit for local changes after the apache#19317 switched to Python 3.7 but also it separates out mypy to a separate non-failing step in CI. In the CI we will be able to see remaining mypy errors. This will allow us to gradually fix all the mypy errors and enable mypy back when we got all the problems fixed.
ca641d7 to
ce35e16
Compare
In order to keep consistency, both mypy and flake were always using Python 3.6 - simply to make sure that the same errors are produced for everyone. When default python version was changed in apache#19317 the regular PR static checks started to fail because Python 3.6 image is no longer built for "regular" PRs (it's only built when "full-tests-needed" is set or when the build runs in "main" as result of push or schedule). Unfortunately those "defaults" could not be read from "default python version" easily, because they are also executed in pre-commits, which do not have the same initialization as `breeze` or other CI scripts so there are literally 3 more places where Python 3.6 should be changed to 3.7. This PR fixes it.
ce35e16 to
aa93e28
Compare
|
MyPy effort is now spread among MANY people :) |
In order to keep consistency, both mypy and flake were always
using Python 3.6 - simply to make sure that the same errors
are produced for everyone. When default python version was
changed in #19317 the regular PR static checks started to fail
because Python 3.6 image is no longer built for "regular" PRs
(it's only built when "full-tests-needed" is set or when
the build runs in "main" as result of push or schedule).
Unfortunately those "defaults" could not be read from
"default python version" easily, because they are also
executed in pre-commits, which do not have the same
initialization as
breezeor other CI scripts so thereare literally 3 more places where Python 3.6 should be
changed to 3.7.
This PR fixes it.
^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code change, Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in UPDATING.md.