Skip to content

Commit bdb494e

Browse files
authored
Merge pull request #1068 from jeromekelleher/reinstate-dump-compress
Reinstate dump compress
2 parents feb0b53 + f4db427 commit bdb494e

File tree

4 files changed

+24
-5
lines changed

4 files changed

+24
-5
lines changed

python/CHANGELOG.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
--------------------
2-
[0.X.X] - 2021-XX-XX
2+
[0.3.4] - 2020-12-02
33
--------------------
44

5-
**Breaking changes**
5+
Minor bugfix release.
66

7-
**Features**
87

98
**Bugfixes**
109

10+
- Reinstate the unused zlib_compression option to tskit.dump, as msprime < 1.0
11+
still uses it (:user:`jeromekelleher`, :issue:`1067`).
1112

1213
--------------------
1314
[0.3.3] - 2020-11-27

python/tests/test_highlevel.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1288,6 +1288,16 @@ def test_dump_load_errors(self):
12881288
with pytest.raises(TypeError):
12891289
func(bad_filename)
12901290

1291+
def test_zlib_compression_warning(self, ts_fixture, tmp_path):
1292+
temp_file = tmp_path / "tmp.trees"
1293+
with warnings.catch_warnings(record=True) as w:
1294+
ts_fixture.dump(temp_file, zlib_compression=True)
1295+
assert len(w) == 1
1296+
assert issubclass(w[0].category, RuntimeWarning)
1297+
with warnings.catch_warnings(record=True) as w:
1298+
ts_fixture.dump(temp_file, zlib_compression=False)
1299+
assert len(w) == 0
1300+
12911301
def test_tables_sequence_length_round_trip(self):
12921302
for sequence_length in [0.1, 1, 10, 100]:
12931303
ts = msprime.simulate(5, length=sequence_length, random_seed=1)

python/tskit/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# Definitive location for the version number.
22
# During development, should be x.y.z.devN
33
# For beta should be x.y.zbN
4-
tskit_version = "0.3.4.dev1"
4+
tskit_version = "0.3.4"

python/tskit/trees.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3207,12 +3207,20 @@ def load_tables(cls, tables, *, build_indexes=False):
32073207
ts.load_tables(tables._ll_tables, build_indexes=build_indexes)
32083208
return TreeSequence(ts)
32093209

3210-
def dump(self, file_or_path):
3210+
def dump(self, file_or_path, zlib_compression=False):
32113211
"""
32123212
Writes the tree sequence to the specified path or file object.
32133213
32143214
:param str file_or_path: The file object or path to write the TreeSequence to.
3215+
:param bool zlib_compression: This parameter is deprecated and ignored.
32153216
"""
3217+
if zlib_compression:
3218+
# Note: the msprime CLI before version 1.0 uses this option, so we need
3219+
# to keep it indefinitely.
3220+
warnings.warn(
3221+
"The zlib_compression option is no longer supported and is ignored",
3222+
RuntimeWarning,
3223+
)
32163224
file, local_file = util.convert_file_like_to_open_file(file_or_path, "wb")
32173225
try:
32183226
self._ll_tree_sequence.dump(file)

0 commit comments

Comments
 (0)