Skip to content

Fix: respect config when opening an existing array #2933

New issue

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

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

Already on GitHub? # to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

ianhi
Copy link
Contributor

@ianhi ianhi commented Mar 26, 2025

Fixes #2931

Previously there were edge cases with open which would result in the write_empty_chunks config was being ignored. This PR has two separate fixes.
1st: for zarr.open line 327
2nd: zarr.open_array required some config parsing as well as a change to the api of AsyncArray.open

  • Add unit tests and/or doctests in docstrings
  • Add docstrings and API docs for any new/modified user-facing classes and functions
  • [NA] New/modified features documented in docs/user-guide/*.rst
  • Changes documented as a new file in changes/
  • GitHub Actions have all passed
  • Test coverage is 100% (Codecov passes)

@github-actions github-actions bot added the needs release notes Automatically applied to PRs which haven't added release notes label Mar 26, 2025
@ianhi
Copy link
Contributor Author

ianhi commented Mar 28, 2025

Discussed with @jhamman at the dev meeting and we came to the following conclusion:

  1. Un-deprecate order and write_empty_chunks in favor of keeping these explicit
  2. deprecate the config argument to create and to AsyncArray
  3. default to the values in the global config when these values are None which should be the default

This keeps better consistency with zarr-python 2 and is more explicit in what the user is passing rather a layer of obfuscation by wrapping in ArrayConfigLike as a dict.

@ianhi
Copy link
Contributor Author

ianhi commented Mar 28, 2025

Motivated by pydata/xarray#10177

cc @d-v-b

@@ -746,6 +746,43 @@ def test_resize_2d(store: MemoryStore, zarr_format: ZarrFormat) -> None:
assert new_shape == z[:].shape


@pytest.mark.parametrize("store", ["local"], indirect=True)
@pytest.mark.parametrize("open", ["open", "open_array"])
def test_append_config_passed(store: LocalStore, open: str, zarr_format: ZarrFormat) -> None:
Copy link
Contributor

@d-v-b d-v-b Apr 18, 2025

Choose a reason for hiding this comment

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

Why do our existing write_empty_chunks tests not work here?

Copy link
Contributor

Choose a reason for hiding this comment

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

for context, it would probably be preferable to expand the scope of an existing test instead of adding a new one

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
needs release notes Automatically applied to PRs which haven't added release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Appending to re-opened zarr array does not respect write_empty_chunks
2 participants