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
add codec_registry as a keyword argument to array access routines #3360
We currently use the global, mutable config object to connect our codec registries with individual arrays. But ideally a global, mutable object would bear as little load as possible in our codebase, when we can express things more clearly via a simpler mechanism: function arguments.
fromyour.moduleimportNewBytesCodecfromzarr.registryimportget_codec_registry# get a copy of the default registry, and update 1 key to have a new valuemy_registry=get_codec_registry("default").update({"bytes": NewBytesCodec})
# open the array with a clearly defined set of codec classesopen_array(..., path="foo"..., codec_registry=my_registry)
We would add a keyword-only argument codec_registry to the function signature of open_array like this:
The default value of "default" would look up a collection of codecs named "default". We could also have a collection named "cupy", making this express something like a "profile". But users could also provide an explicit codec registry object, in which case only those codecs would be used. This would allow mixing cpu and gpu based codecs, in case anyone wants to do that. I think this API is way more explicit than relying on the config object, so we should definitely consider it. This would also address #3261
Activity
d-v-b commentedon Sep 30, 2026
this will get folded in to the addition of a context kwarg passed to array / group accessors