Replies: 4 comments 4 replies
-
Hey @ntouran, the MonkeyType package might be useful to try and add type annotations to the codebase - https://pypi.org/project/MonkeyType/ (solution from https://stackoverflow.com/a/50416746). I haven't tried it yet, but it might be easy to process only module at a time and then go through and update docstrings accordingly for smaller PRs. I might take a stab at this over the holidays. |
Beta Was this translation helpful? Give feedback.
-
I imagine type hinting will be easier to implement than type checking. And we will definitely want to relegate type checking to unit tests or builds only. We don't want to slow down the runtime by doing type checking during a run. |
Beta Was this translation helpful? Give feedback.
-
Okay, after playing with I think However, improving the type hinting to get, say, 80% code coverage might be fairly easy. Perhaps the question is where to start. I might suggest something like these:
|
Beta Was this translation helpful? Give feedback.
-
I have opened an example PR of adding type hinting using I described the strengths and weaknesses of the process there. TLDR; Nothing will fully automate our type hinting. Idea: We should probably request people add type hints to all new, public methods in future ARMI PRs. |
Beta Was this translation helpful? Give feedback.
-
We've learned through the years (as many Python users have) that one major disadvantage of Python is the lack of static typing. This leads to runtime errors that a type checking system would have found at compile time. Fortunately, a bunch of big companies have made type checking pre-processors, like mypy.
We have slowly been putting some type hints in the framework. I'm making this a discussion rather than a ticket because one big ticket about typing would probably be too big of a scope.
If so,
Beta Was this translation helpful? Give feedback.
All reactions