Skip to content

feat: add SupportsSetRange protocol and store implementations#3907

Open
d-v-b wants to merge 4 commits intozarr-developers:mainfrom
d-v-b:feat/byte-range-setter
Open

feat: add SupportsSetRange protocol and store implementations#3907
d-v-b wants to merge 4 commits intozarr-developers:mainfrom
d-v-b:feat/byte-range-setter

Conversation

@d-v-b
Copy link
Copy Markdown
Contributor

@d-v-b d-v-b commented Apr 15, 2026

Adds a protocol for stores that support synchronously and asynchronously writing a bytes into a range in the target object. only MemoryStore and LocalStore implement this.

this behavior is necessary to enable an in-place writing mode for shards, e.g. where a single subchunk is written without re-writing the entire shard.

Add SupportsSetRange protocol for stores that support writing to a byte
range within an existing value (set_range/set_range_sync). Implement
in MemoryStore and LocalStore, both explicitly subclassing the protocol.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions github-actions bot added the needs release notes Automatically applied to PRs which haven't added release notes label Apr 15, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 15, 2026

Codecov Report

❌ Patch coverage is 94.59459% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 93.09%. Comparing base (2fbd30a) to head (2b9d804).

Files with missing lines Patch % Lines
src/zarr/storage/_local.py 93.75% 1 Missing ⚠️
src/zarr/storage/_memory.py 94.73% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3907   +/-   ##
=======================================
  Coverage   93.08%   93.09%           
=======================================
  Files          85       85           
  Lines       11230    11264   +34     
=======================================
+ Hits        10454    10486   +32     
- Misses        776      778    +2     
Files with missing lines Coverage Δ
src/zarr/abc/store.py 96.34% <100.00%> (+0.04%) ⬆️
src/zarr/storage/_local.py 95.27% <93.75%> (-0.14%) ⬇️
src/zarr/storage/_memory.py 94.44% <94.73%> (-0.04%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

d-v-b and others added 2 commits April 15, 2026 11:03
Tests cover isinstance check, async set_range, sync set_range_sync,
and edge case (writing at end of value).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions github-actions bot removed the needs release notes Automatically applied to PRs which haven't added release notes label Apr 15, 2026
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