Configure mypy for CI
nstarman opened this issue · comments
It would be great to add type annotations to plum
! They should be tested, e.g. by pre-commit
, with a configuration in pyproject.toml
.
Hey @nstarman! I fully agree that adding type annotations and eanbling mypy
would be helpful.
One problem is that multiple dispatch really doesn't play nicely with type checkers like mypy
. There are some patterns where you can get things to work together, but getting mypy
to be happy with code that uses the full feature set of Plum is really challenging. This is the main reason I haven't enabled mypy
yet.
Agreed! It often doesn't work with mypy. Where it does work, having static checks are the gold standard. Where it doesn't, maybe using beartype
itself would be sufficient? mypy in pre-commit can be configured to only run on select files. My suggestion is to configure mypy nicely and filter out all files. Then select files can be added as they are typed and if they will support static checks.