diff --git a/CHANGELOG.md b/CHANGELOG.md index 530396080..224939cf3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,13 @@ Write the date in place of the "Unreleased" in the case a new version is release # Changelog +## Unreleased + +### Changed + +- Minor implementation changes were necessary to make Tiled compatible with + Numpy 2.0. + ## v0.1.0b3 (2024-06-04) ### Added diff --git a/pyproject.toml b/pyproject.toml index ff83dd0ee..587b5b17a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -52,7 +52,7 @@ all = [ "asyncpg", "appdirs", "awkward >=2.4.3", - "blosc2", + "blosc2; python_version >= '3.10'", "cachetools", "dask", "dask[array]", @@ -106,7 +106,7 @@ array = [ client = [ "appdirs", "awkward >=2.4.3", - "blosc2", + "blosc2; python_version >= '3.10'", "dask[array]", "dask[dataframe]", "entrypoints", @@ -131,7 +131,7 @@ client = [ # These are used by the client/server to more efficiently compress. # They fall back to gzip (which is slower) if these are not installed. compression = [ - "blosc2", + "blosc2; python_version >= '3.10'", "lz4", "zstandard", ] @@ -228,7 +228,7 @@ server = [ "asgi-correlation-id", "asyncpg", "awkward >=2.4.3", - "blosc2", + "blosc2; python_version >= '3.10'", "cachetools", "dask", "dask[array]", diff --git a/tiled/_tests/test_array.py b/tiled/_tests/test_array.py index f00318deb..6cb0d21e1 100644 --- a/tiled/_tests/test_array.py +++ b/tiled/_tests/test_array.py @@ -48,11 +48,11 @@ inf_tree = MapAdapter( { "example": ArrayAdapter.from_array( - numpy.array([0, 1, numpy.NAN, -numpy.Inf, numpy.Inf]), - metadata={"infinity": math.inf, "-infinity": -math.inf, "nan": numpy.NAN}, + numpy.array([0, 1, numpy.nan, -numpy.inf, numpy.inf]), + metadata={"infinity": math.inf, "-infinity": -math.inf, "nan": numpy.nan}, ) }, - metadata={"infinity": math.inf, "-infinity": -math.inf, "nan": numpy.NAN}, + metadata={"infinity": math.inf, "-infinity": -math.inf, "nan": numpy.nan}, ) arr_with_zero_dim = numpy.array([]).reshape((0, 100, 1, 10)) # Suppress RuntimeWarning: divide by zero encountered in true_divide diff --git a/tiled/_tests/test_decoders.py b/tiled/_tests/test_decoders.py index 47ff36860..5aaaeacf8 100644 --- a/tiled/_tests/test_decoders.py +++ b/tiled/_tests/test_decoders.py @@ -23,6 +23,7 @@ def client(): def test_zstd(client): + pytest.importorskip("zstandard") with record_history() as h: client["compresses_well"] (response,) = h.responses @@ -32,6 +33,7 @@ def test_zstd(client): def test_blosc2(client): + pytest.importorskip("blosc2") ac = client["compresses_well"] with record_history() as h: ac[:] diff --git a/tiled/serialization/image_serializer_helpers.py b/tiled/serialization/image_serializer_helpers.py index 5c593cc72..9b9bd16d6 100644 --- a/tiled/serialization/image_serializer_helpers.py +++ b/tiled/serialization/image_serializer_helpers.py @@ -24,7 +24,6 @@ bool: (False, True), np.bool_: (False, True), float: (-1, 1), - np.float_: (-1, 1), np.float16: (-1, 1), np.float32: (-1, 1), np.float64: (-1, 1), @@ -210,7 +209,7 @@ def _convert(image, dtype, force_copy=False, uniform=False): # is a subclass of that type (e.g. `np.floating` will allow # `float32` and `float64` arrays through) - if np.issubdtype(dtype_in, np.obj2sctype(dtype)): + if np.issubdtype(dtype_in, np.dtype(dtype).type): if force_copy: image = image.copy() return image