Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion py_hamt/ipfszarr3.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,12 @@ def supports_deletes(self) -> bool:
return not self.hamt.read_only

async def delete(self, key: str) -> None:
del self.hamt[key]
try:
del self.hamt[key]
# It's fine if the key was not in the HAMT
# Sometimes zarr v3 calls deletes on keys that don't exist (or have already been deleted) for some reason
except KeyError:
return

@property
def supports_listing(self) -> bool:
Expand Down
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "py-hamt"
version = "2.4.0"
version = "2.4.1"
description = "HAMT implementation for an abstract backing store"
readme = "README.md"
requires-python = ">=3.12"
Expand All @@ -10,7 +10,7 @@ dependencies = [
"multiformats[full]>=0.3.1.post4",
"pycryptodome>=3.21.0",
"requests>=2.32.3",
"zarr",
"zarr>=3.0.6",
]

[build-system]
Expand All @@ -28,6 +28,6 @@ dev = [
"snakeviz>=2.2.0",
"pandas>=2.2.3",
"numpy>=2.1.3",
"xarray>=2025.1.2",
"pytest-asyncio>=0.25.3",
"xarray>=2025.3.0",
]
5 changes: 4 additions & 1 deletion tests/test_zarr_ipfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,8 @@ async def test_write_read(random_zarr_dataset: tuple[str, xr.Dataset]):
# now remove that metadata file and then add it back
ipfszarr3 = IPFSZarr3(ipfszarr3.hamt, read_only=False) # make a writable version
await ipfszarr3.delete("zarr.json")
# doing a duplicate delete should not result in an error
await ipfszarr3.delete("zarr.json")
ipfszarr3_keys: set[str] = set()
async for k in ipfszarr3.list():
ipfszarr3_keys.add(k)
Expand Down Expand Up @@ -201,7 +203,8 @@ def test_encryption(random_zarr_dataset: tuple[str, xr.Dataset]):

ds = xr.open_zarr(
store=IPFSZarr3(
HAMT(store=IPFSStore(), root_node_id=hamt.root_node_id, read_only=True)
HAMT(store=IPFSStore(), root_node_id=ipfszarr3.hamt.root_node_id),
read_only=True,
)
)
print(ds)
Expand Down
18 changes: 9 additions & 9 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading