ci: stricter type checks with mypy#97
Conversation
da9354e to
ee439ac
Compare
|
Sorry for the back and forth. This should be good for review now and is not time critical in any way. |
bd863ca to
ee581b0
Compare
apparently these break either with `|` not defined for `_FieldDescriptor` or - in combination with `from __future__ import annotations` - we end up in GT4Py, which gets confused and can't resolve the argument annotations anymore.
ee581b0 to
a82f340
Compare
|
This PR has been stale for a while due to missing reviews ... If there are any concerns, please let me know. If not, I would be happy if this PR could merge soonish. Remember, I don't have the rights to merge in this repo ... |
My apologies. I don't know if I'm the one holding this up. I sent a message to mm just to clear up when it's okay to merge. |
I was waiting on the review from @FlorianDeconinck, if he is ok with it, I will merge it. |
FlorianDeconinck
left a comment
There was a problem hiding this comment.
Sorry folks, that fell off my plate, good to go !
We can't do any allocation in DaCe code (for good reasons). This PR fixes fallout from NOAA-GFDL#97 where we accidentally introduced the allocaiton of `NullTimer()` in DaCe-owned code. This PR moves the construction of the `Timer` up to calling code. Unrelated, the PR reduces the indet level by adding early returns and adds a couple of type hints here and there.
We can't do any allocation in DaCe code (for good reasons). This PR fixes fallout from NOAA-GFDL#97 where we accidentally introduced the allocaiton of `NullTimer()` in DaCe-owned code. This PR moves the construction of the `Timer` up to calling code. Unrelated, the PR reduces the indet level by adding early returns and adds a couple of type hints here and there.
Description
This PR suggests better defaults for the
mypyconfiguration. The new rules apply don't apply withinpyfv3.stencils. That would have been too much effort to start with. Types aren't less safe than before because before the exceptions were just made for the whole repo (now it's contained topyfv3.stencilsand select files that weren't typed before).In addition, the PR includes
flake8-bugbearDict[...]-> dict[...])Note that even this configuration doesn't catch, what is about to be fixed in #96 (for NOAA-GFDL/pace#156).
/cc @twicki @FlorianDeconinck
How Has This Been Tested?
Self testing with new checks by
mypyandflake8-bugbear. All good as long as CI (in particular the linting job) is still green.Checklist: