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

Add typing to improve the code #604

Open
JCHacking opened this issue Apr 14, 2024 · 2 comments
Open

Add typing to improve the code #604

JCHacking opened this issue Apr 14, 2024 · 2 comments

Comments

@JCHacking
Copy link
Contributor

Add hint typing to the code and use a tool like mypy to analyze it, this can improve development and also prevent bugs.

@sirosen
Copy link
Collaborator

sirosen commented Apr 15, 2024

Also worth noting: with the increasing prevalence of IDE assistive features driven by typing, this could help contributors in a variety of ways.

I've taken a few projects from the pre-typing era into fully typed codebases. The successful ones start small and treat it as a priority to chip away at missing types piece by piece. Once we get far enough along, mypy can be configured to be relatively strict (no-untyped-defs, etc) with excludes for the handful of broken modules.

Once thing which is somewhat controversial is that I'm not a fan of type checking a test suite -- in many cases, it's unhelpful, and you may want to call APIs with mocks or other "unsafe types" to exercise runtime behaviors.

Overall, strong 👍 from me, as long as we start small and lenient, and tighten things up very gradually.

@JCHacking
Copy link
Contributor Author

I am of the same opinion, obviously this is a change that has to be done slowly and avoid breaking anything. It is not something that can be done in one day.

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

No branches or pull requests

2 participants