Skip to content

Fix open(..., mode='w') to create a group #2629

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

Merged
merged 3 commits into from
Jan 3, 2025

Conversation

jni
Copy link
Contributor

@jni jni commented Jan 3, 2025

Closes #2490

I left the ominous todo note above the check because I'm still not sure it's
all the modes for which that code is valid. But it fixes the immediate issue.

TODO:

  • Add unit tests and/or doctests in docstrings
  • Add docstrings and API docs for any new/modified user-facing classes and functions
  • New/modified features documented in docs/tutorial.rst
  • Changes documented in docs/release.rst
  • GitHub Actions have all passed
  • Test coverage is 100% (Codecov passes)

@@ -312,7 +312,7 @@ async def open(
store_path = await make_store_path(store, mode=mode, path=path, storage_options=storage_options)

# TODO: the mode check below seems wrong!
if "shape" not in kwargs and mode in {"a", "r", "r+"}:
if "shape" not in kwargs and mode in {"a", "r", "r+", "w"}:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍
Based on the list of modes, I think the only thing missing here is "w-", so in the future we could also consider simply checking that mode is not "w-", but I don't think we need to do that here.

@d-v-b
Copy link
Contributor

d-v-b commented Jan 3, 2025

The test added here is good, but I assume that we have some pre-existing test that is weaker than it should be. A follow-up PR should find that test and fix it

@normanrz normanrz merged commit 4fe104a into zarr-developers:main Jan 3, 2025
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

zarr.open do not allow creating zarr group (regressions since zarr 3.0.0b1)
3 participants