Skip to content

Commit 3552404

Browse files
committed
chore(deps): make fsspec and upath optional dependencies
1 parent bda158a commit 3552404

File tree

3 files changed

+14
-11
lines changed

3 files changed

+14
-11
lines changed

pyproject.toml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@ requires-python = ">=3.11"
2828
dependencies = [
2929
'numpy>=1.25',
3030
'numcodecs[crc32c]>=0.14',
31-
'fsspec>=2022.10.0',
32-
'typing_extensions>=4.6',
31+
'typing_extensions>=4.9',
3332
'donfig>=0.8',
3433
]
3534

@@ -54,16 +53,16 @@ license = {text = "MIT License"}
5453
keywords = ["Python", "compressed", "ndimensional-arrays", "zarr"]
5554

5655
[project.optional-dependencies]
56+
fsspec = [
57+
"fsspec>=2023.10.0",
58+
]
5759
test = [
5860
"coverage",
5961
"pytest",
6062
"pytest-cov",
61-
"msgpack",
6263
"s3fs",
6364
"pytest-asyncio",
6465
"moto[s3]",
65-
"flask-cors",
66-
"flask",
6766
"requests",
6867
"mypy",
6968
"hypothesis",

tests/test_store/test_core.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
import pytest
55
from _pytest.compat import LEGACY_PATH
6-
from upath import UPath
76

87
from zarr.core.common import AccessModeLiteral
98
from zarr.storage._utils import normalize_path
@@ -72,6 +71,7 @@ async def test_make_store_path_invalid() -> None:
7271

7372

7473
async def test_make_store_path_fsspec(monkeypatch) -> None:
74+
pytest.importorskip("fsspec")
7575
store_path = await make_store_path("http://foo.com/bar")
7676
assert isinstance(store_path.store, RemoteStore)
7777

@@ -106,13 +106,17 @@ async def test_unsupported() -> None:
106106
"foo/bar///",
107107
Path("foo/bar"),
108108
b"foo/bar",
109-
UPath("foo/bar"),
110109
],
111110
)
112-
def test_normalize_path_valid(path: str | bytes | Path | UPath) -> None:
111+
def test_normalize_path_valid(path: str | bytes | Path) -> None:
113112
assert normalize_path(path) == "foo/bar"
114113

115114

115+
def test_normalize_path_upath() -> None:
116+
upath = pytest.importorskip("upath")
117+
assert normalize_path(upath.UPath("foo/bar")) == "foo/bar"
118+
119+
116120
def test_normalize_path_none():
117121
assert normalize_path(None) == ""
118122

tests/test_store/test_remote.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,8 @@
44
import os
55
from typing import TYPE_CHECKING
66

7-
import fsspec
87
import pytest
98
from botocore.session import Session
10-
from upath import UPath
119

1210
import zarr.api.asynchronous
1311
from zarr.core.buffer import Buffer, cpu, default_buffer_prototype
@@ -21,6 +19,7 @@
2119
import botocore.client
2220

2321

22+
fsspec = pytest.importorskip("fsspec")
2423
s3fs = pytest.importorskip("s3fs")
2524
requests = pytest.importorskip("requests")
2625
moto_server = pytest.importorskip("moto.moto_server.threaded_moto_server")
@@ -182,7 +181,8 @@ async def test_remote_store_from_uri(self, store: RemoteStore):
182181
assert dict(group.attrs) == {"key": "value-3"}
183182

184183
def test_from_upath(self) -> None:
185-
path = UPath(
184+
upath = pytest.importorskip("upath")
185+
path = upath.UPath(
186186
f"s3://{test_bucket_name}/foo/bar/",
187187
endpoint_url=endpoint_url,
188188
anon=False,

0 commit comments

Comments
 (0)