diff --git a/pyproject.toml b/pyproject.toml index 583d6e4..340c395 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -97,6 +97,10 @@ overrides.matrix.extras.dependencies = [ overrides.matrix.resolution.features = [ { if = [ "lowest" ], value = "min-reqs" }, # feature added by hatch-min-requirements ] +overrides.matrix.resolution.dependencies = [ + # TODO: move to min dep once this is fixed: https://github.com/tlambert03/hatch-min-requirements/issues/5 + { if = [ "lowest" ], value = "dask==2023.5.1" }, +] [[tool.hatch.envs.hatch-test.matrix]] python = [ "3.13", "3.11" ] diff --git a/src/fast_array_utils/_plugins/dask.py b/src/fast_array_utils/_plugins/dask.py index 535a29c..50406f4 100644 --- a/src/fast_array_utils/_plugins/dask.py +++ b/src/fast_array_utils/_plugins/dask.py @@ -1,10 +1,16 @@ # SPDX-License-Identifier: MPL-2.0 from __future__ import annotations -from dask.array.dispatch import concatenate_lookup, take_lookup, tensordot_lookup +from dask.array.dispatch import concatenate_lookup, tensordot_lookup from scipy.sparse import sparray, spmatrix +try: + from dask.array.dispatch import take_lookup +except ImportError: + take_lookup = None + + # TODO(flying-sheep): upstream # https://github.com/dask/dask/issues/11749 def patch() -> None: # pragma: no cover @@ -13,9 +19,10 @@ def patch() -> None: # pragma: no cover See """ # Avoid patch if already patched or upstream support has been added - if concatenate_lookup.dispatch(sparray) is not concatenate_lookup.dispatch(spmatrix): + if concatenate_lookup.dispatch(sparray) is concatenate_lookup.dispatch(spmatrix): return concatenate_lookup.register(sparray, concatenate_lookup.dispatch(spmatrix)) tensordot_lookup.register(sparray, tensordot_lookup.dispatch(spmatrix)) - take_lookup.register(sparray, take_lookup.dispatch(spmatrix)) + if take_lookup is not None: + take_lookup.register(sparray, take_lookup.dispatch(spmatrix))