plum icon indicating copy to clipboard operation
plum copied to clipboard

Configure mypy for CI

Open nstarman opened this issue 1 year ago • 3 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.

nstarman avatar Apr 27 '24 19:04 nstarman

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.

wesselb avatar May 12 '24 17:05 wesselb

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.

nstarman avatar May 12 '24 17:05 nstarman

@nstarman That sounds very reasonable. I'd be very happy to only enable mypy for the files, or parts thereof where it would work. That would be a nice addition! :)

I'm going to be busy for about as week, but should have some capacity after that.

wesselb avatar May 18 '24 09:05 wesselb