Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ dependencies = [
"numpy",
"humanize",
"tskit>=1.0.0",
"zarr>=3.1",
"zarr>=2.18,<3",
]
dynamic = ["version"]

Expand Down
2 changes: 1 addition & 1 deletion tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ def test_chunk_size(self):
ts = tszip.decompress(outpath)
assert ts.tables == self.ts.tables
store = zarr.storage.ZipStore(str(outpath), mode="r")
root = zarr.open_group(store=store, zarr_format=2, mode="r")
root = zarr.open_group(store=store, mode="r")
for _, g in root.groups():
for _, a in g.arrays():
assert a.chunks == (20,)
Expand Down
8 changes: 4 additions & 4 deletions tests/test_compression.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ def test_format_written(self):
ts = msprime.simulate(10, random_seed=1)
tszip.compress(ts, self.path)
with zarr.storage.ZipStore(str(self.path), mode="r") as store:
root = zarr.open_group(store=store, zarr_format=2, mode="r")
root = zarr.open_group(store=store, mode="r")
assert root.attrs["format_name"] == compression.FORMAT_NAME
assert root.attrs["format_version"] == compression.FORMAT_VERSION

Expand All @@ -305,7 +305,7 @@ def test_provenance(self):
for variants_only in [True, False]:
tszip.compress(ts, self.path, variants_only=variants_only)
with zarr.storage.ZipStore(str(self.path), mode="r") as store:
root = zarr.open_group(store=store, zarr_format=2, mode="r")
root = zarr.open_group(store=store, mode="r")
assert root.attrs["provenance"] == provenance.get_provenance_dict(
{
"variants_only": variants_only,
Expand All @@ -315,7 +315,7 @@ def test_provenance(self):

def write_file(self, attrs, path):
with zarr.storage.ZipStore(str(path), mode="w") as store:
root = zarr.open_group(store=store, zarr_format=2, mode="a")
root = zarr.open_group(store=store, mode="a")
root.attrs.update(attrs)

def test_missing_format_keys(self):
Expand Down Expand Up @@ -539,7 +539,7 @@ def test_good_chunks(self, tmpdir, chunk_size):
assert ts1 == ts2

store = zarr.storage.ZipStore(str(path), mode="r")
root = zarr.open_group(store=store, zarr_format=2, mode="r")
root = zarr.open_group(store=store, mode="r")
for _, g in root.groups():
for _, a in g.arrays():
assert a.chunks == (chunk_size,)
Expand Down
5 changes: 2 additions & 3 deletions tszip/compression.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def compress(ts, destination, variants_only=False, *, chunk_size=None):
filename = pathlib.Path(tmpdir, "tmp.trees.tgz")
logging.debug(f"Writing to temporary file {filename}")
with ZipStore(filename, mode="w") as store:
root = zarr.open_group(store=store, zarr_format=2, mode="a")
root = zarr.open_group(store=store, mode="a")
compress_zarr(ts, root, variants_only=variants_only, chunk_size=chunk_size)
if is_path:
os.replace(filename, destination)
Expand Down Expand Up @@ -156,7 +156,6 @@ def compress(self, root, compressor):
shape=shape,
dtype=dtype,
chunks=self.chunks,
zarr_format=2,
filters=filters,
compressor=compressor,
)
Expand Down Expand Up @@ -297,7 +296,7 @@ def load_zarr(path):
path = str(path)
try:
store = ZipStore(path, mode="r")
root = zarr.open_group(store=store, zarr_format=2, mode="r")
root = zarr.open_group(store=store, mode="r")
except zipfile.BadZipFile as bzf:
raise exceptions.FileFormatError("File is not in tszip format") from bzf

Expand Down
Loading
Loading