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
Order of keys created by ArrayV2Metadata.to_dict has changed between versions #3254
All the fields are the same, but their order is different.
I don't know if this is meant to be preserved between versions or not (it's private API, and unsure if anythig in zarr relies on this), but it was enough of a difference to break virtualizarr (one of a few problems in zarr-developers/VirtualiZarr#677). In our case we care about the order because we take the result and serialize it as json as part of kerchunk reference files, and we had tests checking against the result of older versions.
Maybe you could argue that if it still round-trips via JSON then this shouldn't matter, and VirtualiZarr / Kerchunk are in the wrong?
Steps to reproduce
# /// script# requires-python = ">=3.11"# dependencies = [# "zarr@git+https://github.com/zarr-developers/zarr-python.git@main",# ]# ///## This script automatically imports the development branch of zarr to check for issuesimportzarr# your reproducer code# zarr.print_debug_info()
The array metadata classes model the zarr array metadata documents, which are JSON objects and thus unordered. Additionally, it's generally not a good idea to rely on key order for python dicts. Which tests or functionality are relying on the order of keys in a JSON document?
Since the set of keys is fixed, if the order matters then you can iterate over the keys in the correct order. But from the Zarr POV, the array metadata is unordered.
Activity
d-v-b commentedon Jul 16, 2025
The array metadata classes model the zarr array metadata documents, which are JSON objects and thus unordered. Additionally, it's generally not a good idea to rely on key order for python dicts. Which tests or functionality are relying on the order of keys in a JSON document?
d-v-b commentedon Jul 16, 2025
Since the set of keys is fixed, if the order matters then you can iterate over the keys in the correct order. But from the Zarr POV, the array metadata is unordered.
TomNicholas commentedon Jul 16, 2025
Yes, I think this may be an artifact of Kerchunk / the way we are testing Kerchunk. I'll close this once I'm certain.
TomNicholas commentedon Jul 16, 2025
See context here: zarr-developers/VirtualiZarr#679
I think this issue can probably be closed.