You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Use mypy for static type checking in continuous integration #268
Mypy uses function annotations to perform static type checking. Mypy has the potential to help us track down bugs without even running a program. Lately we've started to add type hints to functions and methods in a few of our subpackages (including atomic, for example) where we sometimes make use of the typing package as well. It would be great if we can use mypy in our suite of tests with Travis CI which would involve updating .travis.yml (which is also being edited in #264).
A potential problem is that some return annotations are given as units:
deffunc() ->u.eV:
I am not sure how mypy will handle that situation. Some function arguments are going to be annotated with the Particle class in order for @particle_input to know what to do with them. That may also make mypy grumpy. Another thing to worry about is that backwards compatibility is not guaranteed for mypy yet, so we might have to make some further adjustments later on. I personally am inexperienced with mypy, but projects such as zulip have added mypy to their Travis CI tests.
Many thanks to whoever ends up working on this! (And also thanks to @Cadair for letting us know about mypy!)
changed the title [-]Use mypy for static type checking in Travis CI[/-][+]Use mypy for static type checking in continuous integration[/+]on Jan 31, 2022
Activity
StanczakDominik commentedon Oct 3, 2018
Probably best to close this one as we hadn't considered mypy and astropy.units clashing?
2 remaining items
[-]Use mypy for static type checking in Travis CI[/-][+]Use mypy for static type checking in continuous integration[/+]namurphy commentedon Jan 31, 2022
Re-opening this because there now exists a workaround for
Quantitytype annotations that preserve units (see #1413).