Skip to content

Commit 0cca6b0

Browse files
authored
chore(deps): make fsspec and upath optional dependencies (#2534)
* chore(deps): make fsspec and upath optional dependencies * bump minimal env * release notes
1 parent fd688c4 commit 0cca6b0

File tree

4 files changed

+39
-14
lines changed

4 files changed

+39
-14
lines changed

Diff for: docs/release.rst

+24-2
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,32 @@ Release notes
1818
See `GH1777 <https://github.com/zarr-developers/zarr-python/issues/1777>`_ for more details on the upcoming
1919
3.0 release.
2020

21+
.. release_3.0.0-beta:
22+
23+
3.0.0-beta series
24+
-----------------
25+
26+
.. warning::
27+
Zarr-Python 3.0.0-beta is a pre-release of the upcoming 3.0 release. This release is not feature complete or
28+
expected to be ready for production applications.
29+
30+
.. note::
31+
The complete release notes for 3.0 have not been added to this document yet. See the
32+
`3.0.0-beta <https://github.com/zarr-developers/zarr-python/releases/tag/v3.0.0-beta>`_ release on GitHub
33+
for a record of changes included in this release.
34+
35+
Dependency Changes
36+
~~~~~~~~~~~~~~~~~~
37+
38+
* fsspec was moved from a required dependency to an optional one. Users should install
39+
fsspec and any relevant implementations (e.g. s3fs) before using the ``RemoteStore``.
40+
By :user:`Joe Hamman <jhamman>` :issue:`2391`.
41+
42+
2143
.. release_3.0.0-alpha:
2244
23-
3.0.0-alpha
24-
-----------
45+
3.0.0-alpha series
46+
------------------
2547

2648
.. warning::
2749
Zarr-Python 3.0.0-alpha is a pre-release of the upcoming 3.0 release. This release is not feature complete or

Diff for: pyproject.toml

+5-6
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",
@@ -224,7 +223,7 @@ dependencies = [
224223
'fsspec==2022.10.0',
225224
's3fs==2022.10.0',
226225
'universal_pathlib==0.0.22',
227-
'typing_extensions==4.6.*', # 4.5 needed for @deprecated, 4.6 for Buffer
226+
'typing_extensions==4.9.*',
228227
'donfig==0.8.*',
229228
# test deps
230229
'hypothesis',

Diff for: tests/test_store/test_core.py

+7-3
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

Diff for: tests/test_store/test_remote.py

+3-3
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)