You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
StoreTests don't test Store.set_partial_values #2859
zarr.testing.store.StoreTests provides some unit tests that any class implementing the Store interface should pass. Currently, there aren't any tests that exercise the abstract Store.set_partial_values API.
I suspect we have set_partial_values only because it's defined in the spec alongside set. In zarr-python we defined set to take a byte_range keyword argument, rendering set_partial_values is unnecessary. We should probably remove that method entirely. And maybe the spec should not have tried to define a store API.
Gotcha, thanks. Although it looks like only some store classes support it, and it's not part of the Store abc yet. Happy to repurpose this issue to discuss that.
Would it be OK to add that to the zarr.abc.Store.set method, even with a default of None? Just unconditionally passing through a byte_range=... argument is liable to break stores that haven't been updated to accept that argument (even if they ignore it). I guess we have a couple options:
Maybe that's the purpose of the supports_partial_writes abstract method? Should we look at that, and pass it through when that's True?
Maybe use inspect.signature to see set accepts support_partial_writes keyword. This is a bit fragile, but might work.
And maybe the spec should not have tried to define a store API.
Yeah, IMO that seems a bit beyond the scope of the spec. I can see something like that being useful in the spec for examples, but not necessarily something that implementations should follow.
actually I was wrong -- StorePath.set takes a byte_range kwarg, but errors if it's not None. But StorePath.set has a different signature from Store.set -- the latter doesn't take a byte_range kwarg. Not sure why we have two store-like classes with subtly different set methods 🙃
to me it seems like the following could work:
Store.set takes a byte_range keyword argument, which defaults to None
Stores that don't support partial writes raise if invoked with a byte_range that's not None.
The caller is then responsible for handling this exception (e.g., by re-writing the entire object, or giving up)
I'm not sure Store.set_partial_values() (or any form of partial writes) is currently being used at all. When I search for set_partial_values in the Zarr-Python codebase, I can only find implementations in Store class and their test.
This suggests to me that maybe we don't need set_partial_values after all?
Activity
d-v-b commentedon Feb 24, 2025
I suspect we have
set_partial_valuesonly because it's defined in the spec alongsideset. Inzarr-pythonwe definedsetto take a byte_range keyword argument, renderingset_partial_valuesis unnecessary. We should probably remove that method entirely. And maybe the spec should not have tried to define a store API.TomAugspurger commentedon Feb 24, 2025
Gotcha, thanks. Although it looks like only some store classes support it, and it's not part of the
Storeabc yet. Happy to repurpose this issue to discuss that.Would it be OK to add that to the
zarr.abc.Store.setmethod, even with a default ofNone? Just unconditionally passing through abyte_range=...argument is liable to break stores that haven't been updated to accept that argument (even if they ignore it). I guess we have a couple options:supports_partial_writesabstract method? Should we look at that, and pass it through when that's True?inspect.signatureto seesetacceptssupport_partial_writeskeyword. This is a bit fragile, but might work.Yeah, IMO that seems a bit beyond the scope of the spec. I can see something like that being useful in the spec for examples, but not necessarily something that implementations should follow.
d-v-b commentedon Feb 24, 2025
actually I was wrong --
StorePath.settakes abyte_rangekwarg, but errors if it's notNone. ButStorePath.sethas a different signature fromStore.set-- the latter doesn't take abyte_rangekwarg. Not sure why we have two store-like classes with subtly differentsetmethods 🙃to me it seems like the following could work:
Store.settakes abyte_rangekeyword argument, which defaults toNonebyte_rangethat's notNone.shoyer commentedon Aug 27, 2025
I'm not sure
Store.set_partial_values()(or any form of partial writes) is currently being used at all. When I search forset_partial_valuesin the Zarr-Python codebase, I can only find implementations in Store class and their test.This suggests to me that maybe we don't need
set_partial_valuesafter all?