Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure mypy for CI #147

Open
nstarman opened this issue Apr 27, 2024 · 3 comments · May be fixed by #179
Open

Configure mypy for CI #147

nstarman opened this issue Apr 27, 2024 · 3 comments · May be fixed by #179

Comments

@nstarman
Copy link
Contributor

nstarman commented Apr 27, 2024

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.

@wesselb
Copy link
Member

wesselb commented May 12, 2024

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.

@nstarman
Copy link
Contributor Author

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.

@wesselb
Copy link
Member

wesselb commented May 18, 2024

@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.

@nstarman nstarman linked a pull request Jun 29, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants