mdanalysis
mdanalysis copied to clipboard
run mypy and pyright in CI
Is your feature request related to a problem?
Type hinting is an addition to modern python that helps detect errors before runtime. Type analysis must be run on the code base separately from when the code is run.
Describe the solution you'd like
Run mypy and pyright as part of CI. Because type hinting of the library is not implemented yet, so the job should only be indicative and not blocking.
Describe alternatives you've considered
Not running the tools as part of CI. However, it will not be sustainable as new code will break the type annotation making its maintenance impossible.
Additional context
This issue is part of @umak1106's outreachy project.
Since you raised the non blocking issue - as far as I'm aware you can't do that properly with GitHub actions (see: https://github.com/actions/runner/issues/2347). It'll need digging into, but my suggestion might be to make it into a separate action so at least we don't get a red badge for multiple months. Right now I can't think of a plan that isn't "we'll ignore the failure", we could make the action trigger only on specific keywords / branch names / etc... if it becomes problematic.
I'd suggest a slightly different approach described in https://github.com/MDAnalysis/mdanalysis/issues/3699#issuecomment-1145942156
I think it might also be more satisfying/motivating for the student to have their hard work "guarded" by CI in early stages of their effort.
That said, while I know this works perfectly well for mypy, I can't comment on pyright. Maybe you could start with mypy in any case.
is this closed by #3705?
I'd like pyright to be included as well, but it is fairly low priority.