Skip to content

numpy v2.0 compatibility #98

@MatthewFlamm

Description

@MatthewFlamm

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_)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions