From 1f8f360e3db716c8aabd7b7b26f39114492cb707 Mon Sep 17 00:00:00 2001 From: Davis Bennett Date: Tue, 5 Nov 2024 20:18:54 +0100 Subject: [PATCH 1/3] use as_posix for str and for listdir --- src/zarr/storage/local.py | 6 ++---- tests/test_store/test_local.py | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/zarr/storage/local.py b/src/zarr/storage/local.py index ba13c2c66..8f538a2b5 100644 --- a/src/zarr/storage/local.py +++ b/src/zarr/storage/local.py @@ -132,7 +132,7 @@ def with_mode(self, mode: AccessModeLiteral) -> Self: return type(self)(root=self.root, mode=mode) def __str__(self) -> str: - return f"file://{self.root}" + return f"file://{self.root.as_posix()}" def __repr__(self) -> str: return f"LocalStore({str(self)!r})" @@ -236,11 +236,9 @@ async def list_prefix(self, prefix: str) -> AsyncGenerator[str, None]: async def list_dir(self, prefix: str) -> AsyncGenerator[str, None]: # docstring inherited base = self.root / prefix - to_strip = str(base) + "/" - try: key_iter = base.iterdir() for key in key_iter: - yield key.as_posix().replace(to_strip, "") + yield key.relative_to(base).as_posix() except (FileNotFoundError, NotADirectoryError): pass diff --git a/tests/test_store/test_local.py b/tests/test_store/test_local.py index 5352e3520..79236e547 100644 --- a/tests/test_store/test_local.py +++ b/tests/test_store/test_local.py @@ -31,7 +31,7 @@ def store_kwargs(self, tmpdir) -> dict[str, str]: return {"root": str(tmpdir), "mode": "r+"} def test_store_repr(self, store: LocalStore) -> None: - assert str(store) == f"file://{store.root!s}" + assert str(store) == f"file://{store.root.as_posix()!s}" def test_store_supports_writes(self, store: LocalStore) -> None: assert store.supports_writes From 5871b53e46d92eb4c38efd90dbeb31e2a5e2ee8c Mon Sep 17 00:00:00 2001 From: Davis Bennett Date: Tue, 5 Nov 2024 20:36:48 +0100 Subject: [PATCH 2/3] release the windows workflows --- .github/workflows/test.yml | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2866ed4b8..4350ec0da 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -33,15 +33,14 @@ jobs: numpy-version: '2.1' dependency-set: 'optional' os: 'macos-latest' - # https://github.com/zarr-developers/zarr-python/issues/2438 - # - python-version: '3.11' - # numpy-version: '1.25' - # dependency-set: 'optional' - # os: 'windows-latest' - # - python-version: '3.13' - # numpy-version: '2.1' - # dependency-set: 'optional' - # os: 'windows-latest' + - python-version: '3.11' + numpy-version: '1.25' + dependency-set: 'optional' + os: 'windows-latest' + - python-version: '3.13' + numpy-version: '2.1' + dependency-set: 'optional' + os: 'windows-latest' runs-on: ${{ matrix.os }} steps: From c8d75034df02530c8f2e1f1f738080b12577cc80 Mon Sep 17 00:00:00 2001 From: Davis Bennett Date: Tue, 5 Nov 2024 20:52:43 +0100 Subject: [PATCH 3/3] unbreak gha --- .github/workflows/test.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4350ec0da..c388ba31d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -33,14 +33,14 @@ jobs: numpy-version: '2.1' dependency-set: 'optional' os: 'macos-latest' - - python-version: '3.11' - numpy-version: '1.25' - dependency-set: 'optional' - os: 'windows-latest' - - python-version: '3.13' - numpy-version: '2.1' - dependency-set: 'optional' - os: 'windows-latest' + - python-version: '3.11' + numpy-version: '1.25' + dependency-set: 'optional' + os: 'windows-latest' + - python-version: '3.13' + numpy-version: '2.1' + dependency-set: 'optional' + os: 'windows-latest' runs-on: ${{ matrix.os }} steps: