astropy / astroplan

Observation planning package for astronomers – maintainer @bmorris3
https://astroplan.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
199 stars 109 forks source link

Add type hints #593

Open vandalt opened 1 month ago

vandalt commented 1 month ago

Hi! This adds type hints and fixes #592.

For astropy quantities, I used Quantity without any physical type or units annotations. The reasons are:

The tests are all passing on my machine.

I was not sure what the formatting guidelines were for this package. Let me know if there are issues on that side!

vandalt commented 1 month ago

I updated formatting so that flake8 check would pass.

I also patched the typing.Self to be backward compatible for Python<3.11.

Currently the tests for Python 3.7 are failing because I used types with subscripts (e.g. np.ndarray[float]). Python 3.7 is EOL, but let me know if I should still make the type hints backward compatible.