From 7976bd8ed758e7e0c67c8b3b231ccd426d94f21d Mon Sep 17 00:00:00 2001 From: Max Jones <14077947+maxrjones@users.noreply.github.com> Date: Thu, 27 Feb 2025 10:47:32 -0500 Subject: [PATCH 1/8] Run minimal tests without fsspec, requests, aiohttp --- pyproject.toml | 20 ++++++++++++-------- tests/test_store/test_core.py | 3 +++ 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 0137927039..23a9263d8b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -72,20 +72,25 @@ gpu = [ test = [ "coverage", "pytest", + "pytest-asyncio", "pytest-cov", + "pytest-accept", + "rich", + "mypy", + "hypothesis", +] +remote_tests = [ 'zarr[remote]', + 'zarr[optional]', "botocore", "s3fs", "moto[s3,server]", - "pytest-asyncio", - "pytest-accept", "requests", +] +optional = [ "rich", - "mypy", - "hypothesis", - "universal-pathlib", + "universal_pathlib" ] -optional = ["rich", "universal-pathlib"] docs = [ # Doc building 'sphinx==8.1.3', @@ -134,7 +139,6 @@ build.hooks.vcs.version-file = "src/zarr/_version.py" [tool.hatch.envs.test] dependencies = [ "numpy~={matrix:numpy}", - "universal_pathlib", ] features = ["test"] @@ -146,7 +150,7 @@ version = ["minimal"] [[tool.hatch.envs.test.matrix]] python = ["3.11", "3.12", "3.13"] numpy = ["1.25", "2.1"] -features = ["optional"] +features = ["remote_tests"] [[tool.hatch.envs.test.matrix]] python = ["3.11", "3.12", "3.13"] diff --git a/tests/test_store/test_core.py b/tests/test_store/test_core.py index bce582a746..73b5c064bf 100644 --- a/tests/test_store/test_core.py +++ b/tests/test_store/test_core.py @@ -1,3 +1,4 @@ +import importlib import tempfile from pathlib import Path @@ -119,6 +120,8 @@ async def test_make_store_path_invalid() -> None: await make_store_path(1) # type: ignore[arg-type] +@pytest.mark.skipif(not importlib.util.find_spec("requests"), reason="requires requests") +@pytest.mark.skipif(not importlib.util.find_spec("aiohttp"), reason="requires aiohttp") async def test_make_store_path_fsspec(monkeypatch) -> None: pytest.importorskip("fsspec") store_path = await make_store_path("http://foo.com/bar") From 11b2c78d645a858c4760f265bcb298022fd1cae6 Mon Sep 17 00:00:00 2001 From: Max Jones <14077947+maxrjones@users.noreply.github.com> Date: Fri, 28 Feb 2025 13:21:08 -0500 Subject: [PATCH 2/8] Retain existing test env names --- pyproject.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 23a9263d8b..15ca4a06fd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -81,7 +81,6 @@ test = [ ] remote_tests = [ 'zarr[remote]', - 'zarr[optional]', "botocore", "s3fs", "moto[s3,server]", @@ -89,7 +88,8 @@ remote_tests = [ ] optional = [ "rich", - "universal_pathlib" + "universal_pathlib", + 'zarr[remote_tests]', ] docs = [ # Doc building @@ -150,7 +150,7 @@ version = ["minimal"] [[tool.hatch.envs.test.matrix]] python = ["3.11", "3.12", "3.13"] numpy = ["1.25", "2.1"] -features = ["remote_tests"] +features = ["optional"] [[tool.hatch.envs.test.matrix]] python = ["3.11", "3.12", "3.13"] From b2442bab8277247ef530805bb70b0bedd9b52503 Mon Sep 17 00:00:00 2001 From: Max Jones <14077947+maxrjones@users.noreply.github.com> Date: Fri, 28 Feb 2025 13:31:15 -0500 Subject: [PATCH 3/8] Use importorskip --- tests/test_store/test_core.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/test_store/test_core.py b/tests/test_store/test_core.py index 73b5c064bf..87d0e6e40d 100644 --- a/tests/test_store/test_core.py +++ b/tests/test_store/test_core.py @@ -1,4 +1,3 @@ -import importlib import tempfile from pathlib import Path @@ -120,10 +119,10 @@ async def test_make_store_path_invalid() -> None: await make_store_path(1) # type: ignore[arg-type] -@pytest.mark.skipif(not importlib.util.find_spec("requests"), reason="requires requests") -@pytest.mark.skipif(not importlib.util.find_spec("aiohttp"), reason="requires aiohttp") async def test_make_store_path_fsspec(monkeypatch) -> None: pytest.importorskip("fsspec") + pytest.importorskip("requests") + pytest.importorskip("aiohttp") store_path = await make_store_path("http://foo.com/bar") assert isinstance(store_path.store, FsspecStore) From 9dc184500d60d4bc6daca1fc5185742e678ef24f Mon Sep 17 00:00:00 2001 From: Max Jones <14077947+maxrjones@users.noreply.github.com> Date: Fri, 28 Feb 2025 15:16:42 -0500 Subject: [PATCH 4/8] Specify which matrix config to upload codecov on --- .github/workflows/test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7d82a95662..4160fa3506 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -64,6 +64,7 @@ jobs: run: | hatch env run --env test.py${{ matrix.python-version }}-${{ matrix.numpy-version }}-${{ matrix.dependency-set }} run-coverage - name: Upload coverage + if: ${{ matrix.dependency-set == 'optional' && matrix.os == 'ubuntu-latest' }} uses: codecov/codecov-action@v5 with: token: ${{ secrets.CODECOV_TOKEN }} From ec880dd6c12f81e880d5512b7dd337203dd76e78 Mon Sep 17 00:00:00 2001 From: Max Jones <14077947+maxrjones@users.noreply.github.com> Date: Sat, 12 Apr 2025 11:15:27 -0400 Subject: [PATCH 5/8] Remove redundant gpu env --- pyproject.toml | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 7e87c76b82..3c125dc686 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -87,11 +87,7 @@ remote_tests = [ "moto[s3,server]", "requests", ] -optional = [ - "rich", - "universal_pathlib", - 'zarr[remote_tests]', -] +optional = ["rich", "universal-pathlib"] docs = [ # Doc building 'sphinx==8.1.3', @@ -161,14 +157,8 @@ python = ["3.11", "3.12", "3.13"] numpy = ["1.25", "2.1"] features = ["optional"] -[[tool.hatch.envs.test.matrix]] -python = ["3.11", "3.12", "3.13"] -numpy = ["1.25", "2.1"] -features = ["gpu"] - [tool.hatch.envs.test.scripts] run-coverage = "pytest --cov-config=pyproject.toml --cov=pkg --cov-report xml --cov=src --junitxml=junit.xml -o junit_family=legacy" -run-coverage-gpu = "pip install cupy-cuda12x && pytest -m gpu --cov-config=pyproject.toml --cov=pkg --cov-report xml --cov=src --junitxml=junit.xml -o junit_family=legacy" run-coverage-html = "pytest --cov-config=pyproject.toml --cov=pkg --cov-report html --cov=src" run = "run-coverage --no-cov" run-pytest = "run" From f5c399075c2c4322ab0cabb788e2f020458dbebc Mon Sep 17 00:00:00 2001 From: Max Jones <14077947+maxrjones@users.noreply.github.com> Date: Sat, 12 Apr 2025 11:24:38 -0400 Subject: [PATCH 6/8] Add obstore to min_deps definition --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 3c125dc686..77cd838921 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -249,6 +249,7 @@ dependencies = [ 'universal_pathlib==0.0.22', 'typing_extensions==4.9.*', 'donfig==0.8.*', + 'obstore==0.5.*', # test deps 'zarr[test]', ] From 1364fb9c73f64c065f1c3b0eb2dbf48ef4963e1b Mon Sep 17 00:00:00 2001 From: Max Jones <14077947+maxrjones@users.noreply.github.com> Date: Sat, 12 Apr 2025 12:09:37 -0400 Subject: [PATCH 7/8] Fix optional dependency set --- pyproject.toml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 77cd838921..a96cc85589 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -150,12 +150,12 @@ features = ["test"] [[tool.hatch.envs.test.matrix]] python = ["3.11", "3.12", "3.13"] numpy = ["1.25", "2.1"] -version = ["minimal"] +deps = ["minimal", "optional"] -[[tool.hatch.envs.test.matrix]] -python = ["3.11", "3.12", "3.13"] -numpy = ["1.25", "2.1"] -features = ["optional"] +[tool.hatch.envs.test.overrides] +matrix.deps.dependencies = [ + {value = "zarr[remote, remote_tests, test, optional]", if = ["optional"]} +] [tool.hatch.envs.test.scripts] run-coverage = "pytest --cov-config=pyproject.toml --cov=pkg --cov-report xml --cov=src --junitxml=junit.xml -o junit_family=legacy" From 0a266d849b87814d5e05d1551490c7acfa80743a Mon Sep 17 00:00:00 2001 From: Max Jones <14077947+maxrjones@users.noreply.github.com> Date: Sat, 12 Apr 2025 12:15:54 -0400 Subject: [PATCH 8/8] Add remote_tests set to doctest --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index a96cc85589..0b351c3b27 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -168,7 +168,7 @@ run-hypothesis = "run-coverage --hypothesis-profile ci --run-slow-hypothesis tes list-env = "pip list" [tool.hatch.envs.doctest] -features = ["test", "optional", "remote"] +features = ["test", "optional", "remote", "remote_tests"] description = "Test environment for doctests" [tool.hatch.envs.doctest.scripts]