Skip to content

Commit 24ed5c2

Browse files
authored
Merge branch 'main' into return-scalar-for-zero-dim-indexing
2 parents e0ef9b1 + 037adf6 commit 24ed5c2

File tree

15 files changed

+143
-27
lines changed

15 files changed

+143
-27
lines changed

.github/workflows/hypothesis.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,12 @@ jobs:
6969
path: .hypothesis/
7070
key: cache-hypothesis-${{ runner.os }}-${{ github.run_id }}
7171

72+
- name: Upload coverage
73+
uses: codecov/codecov-action@v5
74+
with:
75+
token: ${{ secrets.CODECOV_TOKEN }}
76+
verbose: true # optional (default = false)
77+
7278
- name: Generate and publish the report
7379
if: |
7480
failure()

.pre-commit-config.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ ci:
66
default_stages: [pre-commit, pre-push]
77
repos:
88
- repo: https://github.com/astral-sh/ruff-pre-commit
9-
rev: v0.9.1
9+
rev: v0.9.4
1010
hooks:
1111
- id: ruff
1212
args: ["--fix", "--show-fixes"]
1313
- id: ruff-format
1414
- repo: https://github.com/codespell-project/codespell
15-
rev: v2.3.0
15+
rev: v2.4.1
1616
hooks:
1717
- id: codespell
1818
args: ["-L", "fo,ihs,kake,te", "-S", "fixture"]
@@ -37,7 +37,7 @@ repos:
3737
# Tests
3838
- pytest
3939
- repo: https://github.com/scientific-python/cookie
40-
rev: 2024.08.19
40+
rev: 2025.01.22
4141
hooks:
4242
- id: sp-repo-review
4343
- repo: https://github.com/pre-commit/pygrep-hooks
@@ -50,6 +50,6 @@ repos:
5050
hooks:
5151
- id: numpydoc-validation
5252
- repo: https://github.com/twisted/towncrier
53-
rev: 23.11.0
53+
rev: 24.8.0
5454
hooks:
5555
- id: towncrier-check

changes/2778.bugfix.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Use removeprefix rather than replace when removing filename prefixes in `FsspecStore.list`

changes/2801.bugfix.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Ensure utf8 compliant strings are used to construct numpy arrays in property-based tests

changes/2804.feature.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
:py:class:`LocalStore` learned to ``delete_dir``. This makes array and group deletes more efficient.

changes/2807.bugfix.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix pickling for ZipStore

pyproject.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ run = "run-coverage --no-cov"
161161
run-pytest = "run"
162162
run-verbose = "run-coverage --verbose"
163163
run-mypy = "mypy src"
164-
run-hypothesis = "pytest --hypothesis-profile ci tests/test_properties.py tests/test_store/test_stateful*"
164+
run-hypothesis = "run-coverage --hypothesis-profile ci --run-slow-hypothesis tests/test_properties.py tests/test_store/test_stateful*"
165165
list-env = "pip list"
166166

167167
[tool.hatch.envs.doctest]
@@ -398,7 +398,8 @@ filterwarnings = [
398398
"ignore:.*is currently not part in the Zarr format 3 specification.*:UserWarning",
399399
]
400400
markers = [
401-
"gpu: mark a test as requiring CuPy and GPU"
401+
"gpu: mark a test as requiring CuPy and GPU",
402+
"slow_hypothesis: slow hypothesis tests",
402403
]
403404

404405
[tool.repo-review]

src/zarr/storage/_fsspec.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ async def set_partial_values(
341341
async def list(self) -> AsyncIterator[str]:
342342
# docstring inherited
343343
allfiles = await self.fs._find(self.path, detail=False, withdirs=False)
344-
for onefile in (a.replace(self.path + "/", "") for a in allfiles):
344+
for onefile in (a.removeprefix(self.path + "/") for a in allfiles):
345345
yield onefile
346346

347347
async def list_dir(self, prefix: str) -> AsyncIterator[str]:

src/zarr/storage/_local.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,19 @@ async def delete(self, key: str) -> None:
208208
else:
209209
await asyncio.to_thread(path.unlink, True) # Q: we may want to raise if path is missing
210210

211+
async def delete_dir(self, prefix: str) -> None:
212+
# docstring inherited
213+
self._check_writable()
214+
path = self.root / prefix
215+
if path.is_dir():
216+
shutil.rmtree(path)
217+
elif path.is_file():
218+
raise ValueError(f"delete_dir was passed a {prefix=!r} that is a file")
219+
else:
220+
# Non-existent directory
221+
# This path is tested by test_group:test_create_creates_parents for one
222+
pass
223+
211224
async def exists(self, key: str) -> bool:
212225
# docstring inherited
213226
path = self.root / key

src/zarr/storage/_zip.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,8 @@ async def _open(self) -> None:
108108
self._sync_open()
109109

110110
def __getstate__(self) -> dict[str, Any]:
111-
state = self.__dict__
111+
# We need a copy to not modify the state of the original store
112+
state = self.__dict__.copy()
112113
for attr in ["_zf", "_lock"]:
113114
state.pop(attr, None)
114115
return state

0 commit comments

Comments
 (0)