mypy in ci vs pre-commit #5307
-
We would like to add typing in xskillscore. @blackary made a PR to add it in using pre-commit (xarray-contrib/xskillscore#320). For the most part we stay close to xarray for our codebase. I would like to understand #5110 (comment) a bit more. i.e. what was the decision to bring it out of pre-commit and in to a separate step in gha https://github.com/pydata/xarray/blob/master/.github/workflows/ci-additional.yaml#L149 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
That's because
|
Beta Was this translation helpful? Give feedback.
That's because
pre-commit
will create a new environment (usingvenv
/virtualenv
), which contains onlymypy
. This means thatmypy
can check for internal consistency, but the type hints of dependencies (e.g.numpy
) won't be used to check compatibility with those (we would need a full environment for that).pre-commit
has theadditional_dependencies
setting which will install additional packages into the environment, but that's another list of dependencies which can easily get out-of-sync (and I at least didn't know about it when we added the separatemypy
CI).