diff --git a/python/CHANGELOG.rst b/python/CHANGELOG.rst index 88eb949aa6..6c20272933 100644 --- a/python/CHANGELOG.rst +++ b/python/CHANGELOG.rst @@ -1,13 +1,14 @@ -------------------- -[0.X.X] - 2021-XX-XX +[0.3.4] - 2020-12-02 -------------------- -**Breaking changes** +Minor bugfix release. -**Features** **Bugfixes** +- Reinstate the unused zlib_compression option to tskit.dump, as msprime < 1.0 + still uses it (:user:`jeromekelleher`, :issue:`1067`). -------------------- [0.3.3] - 2020-11-27 diff --git a/python/tests/test_highlevel.py b/python/tests/test_highlevel.py index 4ecd123ce6..ddc09443a1 100644 --- a/python/tests/test_highlevel.py +++ b/python/tests/test_highlevel.py @@ -1288,6 +1288,16 @@ def test_dump_load_errors(self): with pytest.raises(TypeError): func(bad_filename) + def test_zlib_compression_warning(self, ts_fixture, tmp_path): + temp_file = tmp_path / "tmp.trees" + with warnings.catch_warnings(record=True) as w: + ts_fixture.dump(temp_file, zlib_compression=True) + assert len(w) == 1 + assert issubclass(w[0].category, RuntimeWarning) + with warnings.catch_warnings(record=True) as w: + ts_fixture.dump(temp_file, zlib_compression=False) + assert len(w) == 0 + def test_tables_sequence_length_round_trip(self): for sequence_length in [0.1, 1, 10, 100]: ts = msprime.simulate(5, length=sequence_length, random_seed=1) diff --git a/python/tskit/_version.py b/python/tskit/_version.py index 849b0013d2..fc184a16d5 100644 --- a/python/tskit/_version.py +++ b/python/tskit/_version.py @@ -1,4 +1,4 @@ # Definitive location for the version number. # During development, should be x.y.z.devN # For beta should be x.y.zbN -tskit_version = "0.3.4.dev1" +tskit_version = "0.3.4" diff --git a/python/tskit/trees.py b/python/tskit/trees.py index 40b2fc183c..50606d170f 100644 --- a/python/tskit/trees.py +++ b/python/tskit/trees.py @@ -3207,12 +3207,20 @@ def load_tables(cls, tables, *, build_indexes=False): ts.load_tables(tables._ll_tables, build_indexes=build_indexes) return TreeSequence(ts) - def dump(self, file_or_path): + def dump(self, file_or_path, zlib_compression=False): """ Writes the tree sequence to the specified path or file object. :param str file_or_path: The file object or path to write the TreeSequence to. + :param bool zlib_compression: This parameter is deprecated and ignored. """ + if zlib_compression: + # Note: the msprime CLI before version 1.0 uses this option, so we need + # to keep it indefinitely. + warnings.warn( + "The zlib_compression option is no longer supported and is ignored", + RuntimeWarning, + ) file, local_file = util.convert_file_like_to_open_file(file_or_path, "wb") try: self._ll_tree_sequence.dump(file)