Skip to content

Conversation

@d-v-b
Copy link
Contributor

@d-v-b d-v-b commented Jan 8, 2026

This PR builds on #3638 to add routines to the store ABC, and thereby all other stores, for handling additional types for the prototype parameter passed to store.get and the methods that call get. This change makes it easier to use store methods without unnecessary imports.

The type of prototype is widened to type[Buffer] | BufferPrototype | None. type[Buffer] | BufferPrototype is compacted to the type alias BufferLike.

When prototype is type[Buffer], the store will use that class directly. Since the stores never use the BufferPrototype.nd_buffer, passing a Buffer class should be preferred over using BufferPrototype.

When prototype is None, the store class retrieves a Buffer class by calling its _get_default_buffer_class method. The default implementation returns the default_buffer_prototype which makes our ABC less abstract but keeps these changes non-breaking.

@codecov
Copy link

codecov bot commented Jan 8, 2026

Codecov Report

❌ Patch coverage is 60.89744% with 61 lines in your changes missing coverage. Please review.
✅ Project coverage is 61.00%. Comparing base (acdd892) to head (68a449e).

Files with missing lines Patch % Lines
src/zarr/storage/_fsspec.py 0.00% 17 Missing ⚠️
src/zarr/abc/store.py 42.85% 12 Missing ⚠️
src/zarr/testing/store.py 69.69% 10 Missing ⚠️
src/zarr/storage/_local.py 75.00% 7 Missing ⚠️
src/zarr/storage/_memory.py 70.83% 7 Missing ⚠️
src/zarr/storage/_common.py 25.00% 3 Missing ⚠️
src/zarr/storage/_obstore.py 81.25% 3 Missing ⚠️
src/zarr/storage/_logging.py 0.00% 1 Missing ⚠️
src/zarr/storage/_wrapper.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3644      +/-   ##
==========================================
+ Coverage   60.90%   61.00%   +0.10%     
==========================================
  Files          86       86              
  Lines       10174    10285     +111     
==========================================
+ Hits         6196     6274      +78     
- Misses       3978     4011      +33     
Files with missing lines Coverage Δ
src/zarr/experimental/cache_store.py 100.00% <100.00%> (ø)
src/zarr/storage/_zip.py 72.98% <100.00%> (+1.13%) ⬆️
src/zarr/storage/_logging.py 61.94% <0.00%> (ø)
src/zarr/storage/_wrapper.py 43.58% <0.00%> (ø)
src/zarr/storage/_common.py 66.00% <25.00%> (ø)
src/zarr/storage/_obstore.py 62.28% <81.25%> (+1.45%) ⬆️
src/zarr/storage/_local.py 72.10% <75.00%> (+1.51%) ⬆️
src/zarr/storage/_memory.py 61.34% <70.83%> (+4.90%) ⬆️
src/zarr/testing/store.py 74.92% <69.69%> (-0.08%) ⬇️
src/zarr/abc/store.py 37.73% <42.85%> (+0.85%) ⬆️
... and 1 more
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@d-v-b d-v-b marked this pull request as ready for review January 8, 2026 17:08
@d-v-b d-v-b requested a review from TomAugspurger January 9, 2026 09:16
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.

1 participant