-
Notifications
You must be signed in to change notification settings - Fork 247
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
Proof of Concept: Types and MyPy #1906
Conversation
@@ -278,7 +279,7 @@ def scan_wrapper( | |||
length, | |||
reverse, | |||
rng_key=None, | |||
substitute_stack=[], | |||
substitute_stack=None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is something I spotted while adding hints. We would want to avoid having mutables as defaults.
@@ -4,6 +4,7 @@ lint: FORCE | |||
ruff check . | |||
ruff format . --check | |||
python scripts/update_headers.py --check | |||
mypy --install-types --non-interactive numpyro |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ignore_missing_imports = true | ||
|
||
[[tool.mypy.overrides]] | ||
module = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here, we can keep adding the modules we want to check. Eventually, we would like to simply remove this and check everything
LGTM! The changes are pretty clean to me. Do you want to submit this? |
Yes, for me, we can merge, and I continue (bit by bit) adding hints (you can also advertise this task and maybe others can help as well, maybe even some of the ones that did it for Pyro ;) ) |
Thanks @juanitorduz! cc @ordabayevy |
This is the first iteration in the journey to add type hints to the project #299 .
We can add types on small and modular iterations, and the community can help (so these can be labeled as good first issues). I found this nice blog https://breadcrumbscollector.tech/mypy-how-to-use-it-in-my-project/ that provides tips on how to add types gradually.
Let me you what you think about this proof-of-concept PR