refactor: one array class#4034
Open
d-v-b wants to merge 25 commits into
Open
Conversation
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ocol Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Array no longer wraps an AsyncArray. It owns metadata, store_path, config, codec_pipeline, _chunk_grid, and a pluggable _runner (defaulting to SyncRunner). Adds Array._from_async_array and a deprecated async_array property. External Array(async_array) construction sites are converted to Array._from_async_array. Fixes downstream typing fallout from removing the _async_array attribute. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…roperty Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…runner Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…unner Routes resize/append/update_attributes/nchunks_initialized/nbytes_stored/ info_complete through self._runner.run(self.*_async(...)), which mutate the live Array. Fixes resize/append not updating array state. Array no longer delegates to the deprecated async_array property. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…hods
Adds get/set_{orthogonal,mask,coordinate,block}_selection_async to Array and
migrates tests off the deprecated async_array property where an Array async
equivalent now exists.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Eliminates duplicated indexer construction and coordinate value-validation by routing each sync selection method through self._runner.run of its *_async twin. Adds get/set_basic_selection_async for a complete surface. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- update_attributes (sync) returns a fresh Array, preserving the prior contract - from_array docstring example uses a public construction path - align SupportsArrayState._iter_shard_keys signature with the real methods - restore AsyncArray coverage in test_get_shape_chunks - extract shared sharding-codec helper to dedup Array/AsyncArray properties Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4034 +/- ##
==========================================
- Coverage 93.55% 93.52% -0.04%
==========================================
Files 88 88
Lines 11896 12009 +113
==========================================
+ Hits 11129 11231 +102
- Misses 767 778 +11
🚀 New features to boost your workflow:
|
Softens the constructor break: Array(async_array) still works but emits a DeprecationWarning, constructing from the async array's metadata/store_path/ config. The new Array(metadata, store_path, ...) form is preferred. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The docs build guards that every python block declares exec/test; the new custom-runner example was a bare fence. Mark it exec="true" (it constructs an Array with a custom runner, which runs cleanly) and drop the unused Runner import. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…compressor/filters) Closes coverage gaps introduced by the Array unification: the store_path-required TypeError, __eq__ NotImplemented path, the sharded read_chunk_sizes/_chunk_grid_shape branch, and the v2/v3 compressor and v2 filters property branches. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…s, iterators, async_array - legacy Array(async_array) raises if store_path/config also supplied - update_attributes_async returns a fresh Array, consistent with the sync form - align Array._iter_shard_coords signature with sibling iterators - async_array property left uncached: resize/append replace metadata so caching would be stale Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
Author
|
the main breaking change I was worried about here is |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR makes 2 fundamental changes to our top-level
Arrayclass:it adds
Array._runner: Runnerto theArray.Runneris a protocol that looks like this:the
runnerparameter allows a caller to provide their own event loop that the array will use when blocking on the execution of a coroutine. If the user doesn't declare a runner, we use a house default, which is justsync. So if you don't request a different runnner, everything is the same.it adds async methods for every sync method. the sync methods use
self.runner.run(self.do_thing())to runThis means the
AsyncArrayclass has no use and can be phased out. NOTE: it is not removed.The goal here is no breaking changes. Removing the
AsyncArrayclass can happen at its own pace. If you find any breaking changes in this PR, we can fix them.