mdanalysis icon indicating copy to clipboard operation
mdanalysis copied to clipboard

run mypy and pyright in CI

Open jbarnoud opened this issue 3 years ago • 4 comments
trafficstars

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.

jbarnoud avatar Jun 03 '22 08:06 jbarnoud

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.

IAlibay avatar Jun 03 '22 08:06 IAlibay

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.

tylerjereddy avatar Jun 03 '22 13:06 tylerjereddy

is this closed by #3705?

hmacdope avatar Jun 23 '22 23:06 hmacdope

I'd like pyright to be included as well, but it is fairly low priority.

jbarnoud avatar Jun 24 '22 07:06 jbarnoud