Skip to content

Commit 3b55281

Browse files
committed
remove gcs scheme support
1 parent ebe9660 commit 3b55281

File tree

4 files changed

+21
-50
lines changed

4 files changed

+21
-50
lines changed

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,6 @@ file = "zarr.storage._builtin_adapters:FileSystemAdapter"
434434
memory = "zarr.storage._builtin_adapters:MemoryAdapter"
435435
https = "zarr.storage._builtin_adapters:HttpsAdapter"
436436
s3 = "zarr.storage._builtin_adapters:S3Adapter"
437-
gcs = "zarr.storage._builtin_adapters:GCSAdapter"
438437
gs = "zarr.storage._builtin_adapters:GSAdapter"
439438
log = "zarr.storage._builtin_adapters:LoggingAdapter"
440439
zip = "zarr.storage._builtin_adapters:ZipAdapter"

src/zarr/storage/_builtin_adapters.py

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626

2727
__all__ = [
2828
"FileSystemAdapter",
29-
"GCSAdapter",
3029
"HttpsAdapter",
3130
"LoggingAdapter",
3231
"MemoryAdapter",
@@ -117,7 +116,7 @@ class RemoteAdapter(StoreAdapter):
117116
118117
Supports any URL scheme that fsspec can handle, including:
119118
- S3: s3://bucket/path
120-
- Google Cloud Storage: gs://bucket/path, gcs://bucket/path
119+
- Google Cloud Storage: gs://bucket/path
121120
- HTTP(S): https://example.com/file.zip, http://example.com/file.zip
122121
- Azure: abfs://container/path, az://container/path
123122
- And many more via fsspec ecosystem
@@ -192,9 +191,6 @@ def _determine_read_only_mode(cls, url: str, **kwargs: Any) -> bool:
192191
@classmethod
193192
def _normalize_url(cls, url: str, scheme: str) -> str:
194193
"""Apply scheme-specific URL normalization."""
195-
if scheme == "gcs":
196-
# Normalize gcs:// to gs:// (fsspec standard)
197-
return "gs://" + url[6:]
198194
return url
199195

200196
@classmethod
@@ -206,7 +202,6 @@ def get_supported_schemes(cls) -> list[str]:
206202
return [
207203
"s3",
208204
"gs",
209-
"gcs", # Google Cloud Storage
210205
"http",
211206
"https", # HTTP(S)
212207
"abfs",
@@ -237,21 +232,14 @@ def get_supported_schemes(cls) -> list[str]:
237232
return ["s3"]
238233

239234

240-
class GCSAdapter(RemoteAdapter):
235+
class GSAdapter(RemoteAdapter):
241236
"""Store adapter for Google Cloud Storage URLs using fsspec."""
242237

243-
adapter_name = "gcs"
238+
adapter_name = "gs"
244239

245240
@classmethod
246241
def get_supported_schemes(cls) -> list[str]:
247-
return ["gcs", "gs"]
248-
249-
250-
# Additional adapter for gs scheme (alias for gcs)
251-
class GSAdapter(GCSAdapter):
252-
"""Alias adapter for gs:// URLs (same as gcs)."""
253-
254-
adapter_name = "gs"
242+
return ["gs"]
255243

256244

257245
class LoggingAdapter(StoreAdapter):
@@ -442,7 +430,7 @@ def _get_fsspec_protocol(cls, url: str) -> str:
442430
"""Get the fsspec protocol name for installation hints."""
443431
if url.startswith("s3://"):
444432
return "s3"
445-
elif url.startswith(("gs://", "gcs://")):
433+
elif url.startswith("gs://"):
446434
return "gs"
447435
elif url.startswith(("http://", "https://")):
448436
return "http"

src/zarr/storage/_register_adapters.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ def register_builtin_adapters() -> None:
1717

1818
from zarr.storage._builtin_adapters import (
1919
FileSystemAdapter,
20-
GCSAdapter,
2120
GSAdapter,
2221
HttpsAdapter,
2322
LoggingAdapter,
@@ -34,7 +33,6 @@ def register_builtin_adapters() -> None:
3433
MemoryAdapter,
3534
HttpsAdapter,
3635
S3Adapter,
37-
GCSAdapter,
3836
GSAdapter,
3937
LoggingAdapter,
4038
ZipAdapter,

tests/test_store/test_zep8.py

Lines changed: 16 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
from zarr.core.buffer import default_buffer_prototype
1919
from zarr.registry import get_store_adapter, register_store_adapter
2020
from zarr.storage import FsspecStore, LocalStore, LoggingStore, MemoryStore, ZipStore
21-
from zarr.storage._builtin_adapters import GCSAdapter, HttpsAdapter, LoggingAdapter, S3Adapter
21+
from zarr.storage._builtin_adapters import GSAdapter, HttpsAdapter, LoggingAdapter, S3Adapter
2222
from zarr.storage._common import make_store_path
2323
from zarr.storage._zep8 import URLParser, URLStoreResolver, ZEP8URLError, is_zep8_url
2424

@@ -428,8 +428,8 @@ def test_fsspec_store_adapters_registered() -> None:
428428
https_adapter = get_store_adapter("https")
429429
assert https_adapter is not None
430430

431-
gcs_adapter = get_store_adapter("gcs")
432-
assert gcs_adapter is not None
431+
gs_adapter = get_store_adapter("gs")
432+
assert gs_adapter is not None
433433

434434

435435
async def test_fsspec_s3_url_resolution() -> None:
@@ -496,7 +496,7 @@ async def test_make_store_path_with_fsspec_urls() -> None:
496496

497497
# Test that fsspec URLs still work with make_store_path
498498
# Note: These will fail to connect but should parse correctly
499-
fsspec_urls = ["s3://bucket/path", "gcs://bucket/path", "https://example.com/data"]
499+
fsspec_urls = ["s3://bucket/path", "gs://bucket/path", "https://example.com/data"]
500500

501501
for url in fsspec_urls:
502502
# These should not be detected as ZEP 8 URLs
@@ -514,7 +514,7 @@ def test_fsspec_zep8_url_detection() -> None:
514514
zep8_urls = [
515515
"s3://bucket/data.zip|zip:",
516516
"https://example.com/data|zip:|zarr3:",
517-
"gcs://bucket/data.zarr|zarr2:",
517+
"gs://bucket/data.zarr|zarr2:",
518518
]
519519

520520
for url in zep8_urls:
@@ -524,7 +524,7 @@ def test_fsspec_zep8_url_detection() -> None:
524524
regular_urls = [
525525
"s3://bucket/data.zarr",
526526
"https://example.com/data.zarr",
527-
"gcs://bucket/data",
527+
"gs://bucket/data",
528528
]
529529

530530
for url in regular_urls:
@@ -574,10 +574,10 @@ def test_fsspec_schemes_support() -> None:
574574
assert set(HttpsAdapter.get_supported_schemes()) == {"http", "https"}
575575

576576
# Test GCS adapter
577-
assert GCSAdapter.can_handle_scheme("gcs")
578-
# GCS adapter supports both gcs:// and gs:// schemes
579-
supported_schemes = GCSAdapter.get_supported_schemes()
580-
assert "gcs" in supported_schemes or "gs" in supported_schemes
577+
assert GSAdapter.can_handle_scheme("gs")
578+
# GCS adapter only supports gs:// scheme
579+
supported_schemes = GSAdapter.get_supported_schemes()
580+
assert "gs" in supported_schemes
581581

582582

583583
async def test_fsspec_url_chain_parsing() -> None:
@@ -590,7 +590,7 @@ async def test_fsspec_url_chain_parsing() -> None:
590590
complex_urls = [
591591
"s3://bucket/archive.zip|zip:data/|zarr3:group",
592592
"https://example.com/data.tar.gz|tar:|zip:|zarr2:",
593-
"gcs://bucket/dataset.zarr|zarr3:array/subarray",
593+
"gs://bucket/dataset.zarr|zarr3:array/subarray",
594594
]
595595

596596
for url in complex_urls:
@@ -1236,27 +1236,16 @@ async def test_s3_adapter_functionality() -> None:
12361236

12371237

12381238
async def test_gcs_adapter_functionality() -> None:
1239-
"""Test GCSAdapter functionality."""
1240-
from zarr.storage._builtin_adapters import GCSAdapter
1239+
"""Test GSAdapter functionality."""
12411240

12421241
# Test can_handle_scheme
1243-
assert GCSAdapter.can_handle_scheme("gs")
1244-
assert GCSAdapter.can_handle_scheme("gcs")
1245-
assert not GCSAdapter.can_handle_scheme("s3")
1242+
assert GSAdapter.can_handle_scheme("gs")
1243+
assert not GSAdapter.can_handle_scheme("s3")
12461244

12471245
# Test get_supported_schemes
1248-
schemes = GCSAdapter.get_supported_schemes()
1249-
assert "gs" in schemes
1250-
assert "gcs" in schemes
1251-
1252-
1253-
async def test_gs_adapter_functionality() -> None:
1254-
"""Test GSAdapter (alias) functionality."""
1255-
from zarr.storage._builtin_adapters import GSAdapter
1256-
1257-
# GSAdapter is an alias for GCSAdapter
12581246
schemes = GSAdapter.get_supported_schemes()
12591247
assert "gs" in schemes
1248+
assert len(schemes) == 1 # Should only support gs now
12601249

12611250

12621251
async def test_https_adapter_functionality() -> None:
@@ -1351,7 +1340,6 @@ def test_builtin_adapters_imports_and_module_structure() -> None:
13511340
# Test that all adapter classes can be imported
13521341
from zarr.storage._builtin_adapters import (
13531342
FileSystemAdapter,
1354-
GCSAdapter,
13551343
GSAdapter,
13561344
HttpsAdapter,
13571345
LoggingAdapter,
@@ -1366,16 +1354,14 @@ def test_builtin_adapters_imports_and_module_structure() -> None:
13661354
assert MemoryAdapter.adapter_name == "memory"
13671355
assert RemoteAdapter.adapter_name == "remote"
13681356
assert S3Adapter.adapter_name == "s3"
1369-
assert GCSAdapter.adapter_name == "gcs"
13701357
assert GSAdapter.adapter_name == "gs"
13711358
assert HttpsAdapter.adapter_name == "https"
13721359
assert LoggingAdapter.adapter_name == "log"
13731360
assert ZipAdapter.adapter_name == "zip"
13741361

13751362
# Test inheritance relationships
13761363
assert issubclass(S3Adapter, RemoteAdapter)
1377-
assert issubclass(GCSAdapter, RemoteAdapter)
1378-
assert issubclass(GSAdapter, GCSAdapter)
1364+
assert issubclass(GSAdapter, RemoteAdapter)
13791365
assert issubclass(HttpsAdapter, RemoteAdapter)
13801366

13811367

0 commit comments

Comments
 (0)