Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .github/workflows/array-api-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ jobs:
matrix:
os: ["ubuntu-latest"]
python-version: ["3.11"]
zarr: ["<3", ">3"]

steps:
- name: Checkout Cubed
Expand All @@ -46,9 +45,6 @@ jobs:
pushd array-api-tests
pip install -e '../cubed[test]'
pip install -r requirements.txt # from Array API tests repo
- name: Install zarr${{ matrix.zarr }}
run: |
pip install -U 'zarr${{ matrix.zarr }}'
- name: Run Array API tests
env:
ARRAY_API_TESTS_MODULE: cubed.array_api
Expand Down
5 changes: 0 additions & 5 deletions .github/workflows/slow-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ jobs:
matrix:
os: ["ubuntu-latest"]
python-version: ["3.11"]
zarr: ["<3"]

steps:
- name: Checkout source
Expand All @@ -43,10 +42,6 @@ jobs:
run: |
python -m pip install -e .[test] memray

- name: Install zarr${{ matrix.zarr }}
run: |
python -m pip install -U 'zarr${{ matrix.zarr }}'

- name: Run tests
run: |
pytest -vs -k slow --runslow
58 changes: 0 additions & 58 deletions .github/workflows/zarr-v2-tests.yml

This file was deleted.

36 changes: 3 additions & 33 deletions cubed/storage/store.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,13 @@
def get_storage_name() -> str:
# get storage name from top-level config
# e.g. set globally with CUBED_STORAGE_NAME=tensorstore
storage_name = config.get("storage_name", None)

if storage_name is None:
import zarr

if zarr.__version__[0] == "3":
storage_name = "zarr-python-v3"
else:
storage_name = "zarr-python"

return storage_name
return config.get("storage_name", "zarr-python-v3")


def is_storage_array(obj) -> bool:
storage_name = get_storage_name()

if storage_name == "zarr-python":
import zarr

from cubed.storage.stores.zarr_python import ZarrArrayGroup # type: ignore

return isinstance(obj, (zarr.Array, ZarrArrayGroup))
elif storage_name in ("zarr-python-v3", "zarrs-python"):
if storage_name in ("zarr-python", "zarr-python-v3", "zarrs-python"):
import zarr

from cubed.storage.stores.zarr_python_v3 import ZarrV3ArrayGroup
Expand Down Expand Up @@ -58,21 +42,7 @@ def open_storage_array(
):
storage_name = get_storage_name()

if storage_name == "zarr-python":
from cubed.storage.stores.zarr_python import open_zarr_array # type: ignore

open_func = open_zarr_array

# set object codec if needed
import numpy as np

if np.dtype(dtype).hasobject and "object_codec" not in kwargs:
import numcodecs

object_codec = numcodecs.Pickle()
kwargs["object_codec"] = object_codec

elif storage_name == "zarr-python-v3":
if storage_name in ("zarr-python", "zarr-python-v3"):
from cubed.storage.stores.zarr_python_v3 import open_zarr_v3_array

open_func = open_zarr_v3_array
Expand Down
72 changes: 0 additions & 72 deletions cubed/storage/stores/zarr_python.py

This file was deleted.

8 changes: 1 addition & 7 deletions cubed/tests/storage/test_zarr.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
import pytest
import zarr
from numcodecs.registry import get_codec

from cubed import config
from cubed.storage.store import open_storage_array
from cubed.storage.zarr import lazy_zarr_array

ZARR_PYTHON_V3 = zarr.__version__[0] == "3"


def test_lazy_zarr_array(tmp_path):
zarr_path = tmp_path / "lazy.zarr"
Expand All @@ -22,9 +19,6 @@ def test_lazy_zarr_array(tmp_path):
arr.open()


@pytest.mark.skipif(
ZARR_PYTHON_V3, reason="setting zarr compressor not yet possible for Zarr Python v3"
)
@pytest.mark.parametrize(
"compressor",
[
Expand All @@ -41,7 +35,7 @@ def test_compression(tmp_path, compressor):
)
arr.create()

# open with zarr python (for zarr python v2 and tensorstore)
# open with zarr python (for zarr python and tensorstore)
with config.set({"storage_name": "zarr-python"}):
z = open_storage_array(zarr_path, mode="r")

Expand Down
6 changes: 2 additions & 4 deletions cubed/tests/test_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,10 @@
import cubed.array_api as xp
from cubed.storage.store import get_storage_name

ZARR_PYTHON_V2 = zarr.__version__[0] == "2"


@pytest.mark.skipif(
ZARR_PYTHON_V2 or get_storage_name() == "tensorstore",
reason="setting an arbitrary Zarr store is not supported for Zarr Python v2, or tensorstore",
get_storage_name() == "tensorstore",
reason="setting an arbitrary Zarr store is not supported for tensorstore",
)
def test_arbitrary_zarr_store():
store = zarr.storage.MemoryStore()
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ dependencies = [
"psutil",
"tenacity",
"toolz",
"zarr != 3.1.2",
"zarr > 3.1.2",
]

[project.optional-dependencies]
Expand Down
Loading