Skip to content

Specify read-only mode#608

Merged
jeromekelleher merged 1 commit into
tskit-dev:mainfrom
szhan:zipstore_read_only
May 15, 2026
Merged

Specify read-only mode#608
jeromekelleher merged 1 commit into
tskit-dev:mainfrom
szhan:zipstore_read_only

Conversation

@szhan
Copy link
Copy Markdown
Member

@szhan szhan commented May 15, 2026

Fix #607

Comment thread sc2ts/dataset.py
self.store = zarr.ZipStore(path, mode="r")
else:
self.store = zarr.DirectoryStore(path)
self.root = zarr.open(self.store, mode="r")
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This seems a bit redundant to specify read-only mode again when calling open. I guess there's no harm in that.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It's a wart on Zarr apis all right, but it's necessary.

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented May 15, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.07%. Comparing base (1bd7cbb) to head (4cd6484).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #608   +/-   ##
=======================================
  Coverage   88.07%   88.07%           
=======================================
  Files          12       12           
  Lines        4134     4134           
  Branches      585      585           
=======================================
  Hits         3641     3641           
  Misses        365      365           
  Partials      128      128           
Flag Coverage Δ
python-tests 88.07% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jeromekelleher
Copy link
Copy Markdown
Member

Best add mode=r on DirectoryStore also

@szhan
Copy link
Copy Markdown
Member Author

szhan commented May 15, 2026

I checked but there's no mode argument

class DirectoryStore(
    path: Any,
    normalize_keys: bool = False,
    dimension_separator: DIMENSION_SEPARATOR | None = None
)

@jeromekelleher jeromekelleher merged commit 52cc5d7 into tskit-dev:main May 15, 2026
9 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.

Can't open a read-only dataset

3 participants