Add mypy pre-commit#140
Conversation
| hooks: | ||
| - id: mypy | ||
| additional_dependencies: | ||
| - types-requests |
There was a problem hiding this comment.
Requests are not used directly here, let's remove this line for now.
| hooks: | ||
| - id: mypy | ||
| additional_dependencies: | ||
| - types-requests |
There was a problem hiding this comment.
| - types-requests |
|
@MarianaVZorzo as expected, when we added type hinting checking, we got tons of "erros" from types that are not defined: We should slowly fix those. I'll send an example ASAP for you to follow on how to add types to the library. Some may be low hanging fruit, others a bit more involved. This is not something we want to do in a single PR. |
|
Thanks, Filipe! I removed types-requests. I see the mypy errors and I'll wait for your example and the next steps :) |
|
Question: why a pre-commit hook, rather than a CI job (that's allowed to fail) -- particularly this early in the game, where it's a long way from passing ? |
That is "pre-commit-ci" it has the advantage to save on GitHub API tokens. We can run a CI test on GitHub actions for it, but the author deprecated it in liue for pre-commit CI. With that said, we can run the mypy only check with GitHub Actions CIs. |
|
I'm still a bit confused about what "pre-commit-ci" is -- but I did look into a bit, and this does seem to make sense for this -- thanks! |
Sorry I was not clear, but the gist of it is that pre-commit-ci runs the pre-commit hooks for us as part of a PR test matrix. That helps folks who do not have the hooks installed locally. I do prefer to run it in GitHub Actions, but the author deprecated it :-/ With that said, pre-commit-ci is not bad. It is fast, isolated and safe, and save us GH tokens. (We don't get rate limited here, but in big orgs that last one sure comes in handy.) |
Adds the mypy pre-commit hook configuration following the setup used in erddapy.