matplotlib/cmocean

numpy v2.0 compatibility

MatthewFlamm opened this issue · 0 comments

When testing with this package as a dependency and numpy 2.0 dev version, I'm getting the following error:

[rest of log shortened]
/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/cmocean/tools.py:12: in <module>
    _string_types = (str, np.str_, np.unicode_)
/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/numpy/__init__.py:396: in __getattr__
    raise AttributeError(
E   AttributeError: `np.unicode_` was removed in the NumPy 2.0 release. Use `np.str_` instead.

Can the np.unicode_ be removed in these lines?

cmocean/cmocean/tools.py

Lines 11 to 14 in 4b627ff

if sys.version_info > (3,):
_string_types = (str, np.str_, np.unicode_)
else:
_string_types = (basestring, np.str_, np.unicode_)