Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow missing 'configuration' in chunk_key_encoding #2025

Closed
joshmoore opened this issue Jul 10, 2024 · 3 comments
Closed

allow missing 'configuration' in chunk_key_encoding #2025

joshmoore opened this issue Jul 10, 2024 · 3 comments
Assignees
Milestone

Comments

@joshmoore
Copy link
Member

joshmoore commented Jul 10, 2024

Similar to #2024, the "configuration" key of chunk_key_encoding is optional. If it's missing, a ValueError is raised:

  File "/Users/jamoore/opt/challenge/zarr-python/src/zarr/common.py", line 130, in parse_named_configuration
    raise ValueError(f"Named configuration does not have a 'configuration' key. Got {data}.")
ValueError: Named configuration does not have a 'configuration' key. Got {'name': 'default'}.

cc: @d-v-b

Edit: data was originally written by tensorstore

@joshmoore joshmoore added the V3 label Jul 10, 2024
@d-v-b d-v-b self-assigned this Jul 10, 2024
@joshmoore
Copy link
Member Author

diff --git a/src/zarr/common.py b/src/zarr/common.py
index 342db141..1534fa16 100644
--- a/src/zarr/common.py
+++ b/src/zarr/common.py
@@ -127,6 +127,7 @@ def parse_named_configuration(
     if "configuration" in data:
         configuration_parsed = parse_configuration(data["configuration"])
     elif require_configuration:
+        return name_parsed, {}

works around the immediate issue

@d-v-b
Copy link
Contributor

d-v-b commented Jul 11, 2024

yes that would be an immediate fix. longer term we should remove parse_named_configuration and replace it with something like parse_chunk_key_encoding, parse_chunk_grid, etc, that each can handle a NamedConfiguration as input.

@joshmoore
Copy link
Member Author

The same testing for #2029 applies:

  • this error was occurring with 3.0.0a0
  • but not with 3.0.0b1

🎉

@github-project-automation github-project-automation bot moved this from Todo to Done in Zarr-Python - 3.0 Nov 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

No branches or pull requests

3 participants