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

Fix Python 3.9 annotations error #373

Merged
merged 1 commit into from
Dec 20, 2024

Conversation

robbibt
Copy link
Contributor

@robbibt robbibt commented Dec 20, 2024

On PyTMD 2.19 our Python 3.9 tests have started failing:
https://github.com/GeoscienceAustralia/eo-tides/actions/runs/12424548030/job/34689878792#step:5:106

eo_tides/eo.py:18: in <module>
    from .model import model_tides
eo_tides/model.py:21: in <module>
    import pyTMD
.venv/lib/python3.9/site-packages/pyTMD/__init__.py:14: in <module>
    import pyTMD.arguments
.venv/lib/python3.9/site-packages/pyTMD/arguments.py:86: in <module>
    import pyTMD.astro
.venv/lib/python3.9/site-packages/pyTMD/astro.py:57: in <module>
    from pyTMD.math import (
.venv/lib/python3.9/site-packages/pyTMD/math.py:32: in <module>
    coefficients: list | np.ndarray,
E   TypeError: unsupported operand type(s) for |: 'type' and 'type'

I think this is because "|" style typing in the math module isn't supported before Python 3.10 without importing from __future__ import annotations first.

This PR adds this line into math.py, to see if this resolves this error.

@tsutterley tsutterley merged commit 5af1557 into tsutterley:main Dec 20, 2024
4 checks passed
@tsutterley
Copy link
Owner

Merged!

@robbibt
Copy link
Contributor Author

robbibt commented Dec 20, 2024

@tsutterley Yay, works great now! 🚀 Screenshot_20241221-081045.png

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.

2 participants