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

import tobac broken for Python<3.10 #467

Closed
4 tasks
freemansw1 opened this issue Nov 13, 2024 · 0 comments · Fixed by #468
Closed
4 tasks

import tobac broken for Python<3.10 #467

freemansw1 opened this issue Nov 13, 2024 · 0 comments · Fixed by #468
Assignees
Labels
bug Code that is failing or producing the wrong result

Comments

@freemansw1
Copy link
Member

If you install tobac from scratch on Python <3.10, import tobac fails with the following error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/seanfreeman/mambaforge/envs/tobac_test_aux_geoir/lib/python3.9/site-packages/tobac/__init__.py", line 83, in <module>
    from . import merge_split
  File "/Users/seanfreeman/mambaforge/envs/tobac_test_aux_geoir/lib/python3.9/site-packages/tobac/merge_split.py", line 31, in <module>
    vertical_coord: Optional[str] | None = None,
TypeError: unsupported operand type(s) for |: '_UnionGenericAlias' and 'NoneType'

This makes sense, as the | character as an alias for union wasn't introduced until 3.10.

The fix for this is easy: add from __future__ import annotations to this file (and all other files), but this raises a key question: why did our matrix tests not catch this?

I think this fix warrants a v1.5.5, unfortunately.

  • Have you searched the issue tracker for the same problem?
  • Have you checked if you're using the latest version? If not, which version are you using?
  • Have you mentioned the steps to reproduce the issue?
  • Have you, if applicable, included error messages?
@freemansw1 freemansw1 added the bug Code that is failing or producing the wrong result label Nov 13, 2024
@freemansw1 freemansw1 self-assigned this Nov 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Code that is failing or producing the wrong result
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant