Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add mypy type checking #133

Closed
wants to merge 4 commits into from
Closed

Add mypy type checking #133

wants to merge 4 commits into from

Conversation

dstansby
Copy link
Member

Since we're already using black in this repository, I thought it was worth experimenting with mypy here too. This PR adds basic mypy pre-commit config, and fixes all the issues it had.

@nabobalis
Copy link
Contributor

Oldest failure is:

../../.tox/py38-oldestdeps/lib/python3.8/site-packages/sunkit_image/tests/test_time_lag.py:7: in <module>
    from sunkit_image.time_lag import cross_correlation, get_lags, max_cross_correlation, time_lag
../../.tox/py38-oldestdeps/lib/python3.8/site-packages/sunkit_image/time_lag.py:167: in <module>
    def time_lag(signal_a, signal_b, time: u.s, lag_bounds: Optional[u.Quantity[u.s]] = None, **kwargs):
../../.tox/py38-oldestdeps/lib/python3.8/site-packages/astropy/units/quantity.py:422: in __class_getitem__
    warnings.warn(
E   UserWarning: Quantity annotations are valid static type annotations only if Python is v3.9+ or `typing_extensions` is installed.

@nabobalis
Copy link
Contributor

I think it's worth a changelog entry.

@nabobalis
Copy link
Contributor

38-oldest is failing:

../../.tox/py38-oldestdeps/lib/python3.8/site-packages/sunkit_image/tests/test_time_lag.py:7: in <module>
    from sunkit_image.time_lag import cross_correlation, get_lags, max_cross_correlation, time_lag
../../.tox/py38-oldestdeps/lib/python3.8/site-packages/sunkit_image/time_lag.py:167: in <module>
    def time_lag(signal_a, signal_b, time: u.s, lag_bounds: Optional[u.Quantity[u.s]] = None, **kwargs):
../../.tox/py38-oldestdeps/lib/python3.8/site-packages/astropy/units/quantity.py:422: in __class_getitem__
    warnings.warn(
E   UserWarning: Quantity annotations are valid static type annotations only if Python is v3.9+ or `typing_extensions` is installed.

But I think it might be time to drop 38.

@dstansby
Copy link
Member Author

Boo, I'll leave this until py38 is dropped then :thu

@nabobalis nabobalis mentioned this pull request Aug 9, 2023
@nabobalis nabobalis closed this Aug 9, 2023
@nabobalis
Copy link
Contributor

This PR was replaced by #156, I took the commits and merged in main.

@dstansby dstansby deleted the mypy branch August 10, 2023 07:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants