From 65b4caeecbcb8f574d4c3c83c6bd0a673fb444f2 Mon Sep 17 00:00:00 2001 From: Ben Jeffery Date: Thu, 27 Jun 2024 16:00:10 +0100 Subject: [PATCH 1/3] Post release tasks --- python/CHANGELOG.rst | 9 ++++++++- python/tskit/_version.py | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/python/CHANGELOG.rst b/python/CHANGELOG.rst index 1fd56f3b01..3b453021c7 100644 --- a/python/CHANGELOG.rst +++ b/python/CHANGELOG.rst @@ -1,5 +1,5 @@ -------------------- -[0.5.8] - 2024-XX-XX +[0.5.9] - 2024-XX-XX -------------------- **Breaking Changes** @@ -41,6 +41,13 @@ (:user:`currocam`, :pr:`2960`) +-------------------- +[0.5.8] - 2024-06-27 +-------------------- + +- Add support for numpy 2 (:user:`jeromekelleher`, :user:`benjeffery`, :pr:`2964`) + + -------------------- [0.5.7] - 2024-06-17 -------------------- diff --git a/python/tskit/_version.py b/python/tskit/_version.py index 80cdfcb3d3..eea1001a59 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.5.8.dev0" +tskit_version = "0.5.9.dev0" From 443076307e7563e56d8d290402d75755ef6ec6e2 Mon Sep 17 00:00:00 2001 From: Yan Wong Date: Mon, 15 Jan 2024 11:13:23 +0000 Subject: [PATCH 2/3] Add direct links to Python and C APIs from README --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 47e729ccdd..6f3bf116ea 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,8 @@ issue for a specific bug or feature request. We warmly welcome contributions from the community. Raise an issue if you have an idea you'd like to work on, or submit a PR for comments and help. -The base `tskit` library provides both a Python and C API. A Rust API is provided in the +The base `tskit` library provides both a [Python](https://tskit.dev/tskit/docs/latest/python-api.html) +and [C](https://tskit.dev/tskit/docs/latest/c-api.html) API. A Rust API is provided in the [tskit-rust](https://github.com/tskit-dev/tskit-rust) repository. From cc49b84e6f0c7ec78954577e9736c3c758950436 Mon Sep 17 00:00:00 2001 From: Yan Wong Date: Thu, 2 Mar 2023 15:22:21 +0000 Subject: [PATCH 3/3] str(null_schema) returns a meaningful string --- python/CHANGELOG.rst | 6 ++++-- python/tests/test_metadata.py | 5 ++++- python/tests/test_tables.py | 6 +++--- python/tskit/metadata.py | 9 ++++++++- 4 files changed, 19 insertions(+), 7 deletions(-) diff --git a/python/CHANGELOG.rst b/python/CHANGELOG.rst index 3b453021c7..ecddf5b99d 100644 --- a/python/CHANGELOG.rst +++ b/python/CHANGELOG.rst @@ -24,6 +24,9 @@ in the presence of non-ancestral material (very rare). (:user:`petrelharp`, :issue:`2983`, :pr:`1623`) +- Printing ``tskit.MetadataSchema(schema=None)`` now shows ``"Null_schema"`` rather + than ``None``, to avoid confusion (:user:`hyanwong`, :pr:`2720`) + **Features** - Add ``TreeSequence.extend_haplotypes`` method that extends ancestral haplotypes @@ -110,8 +113,7 @@ - Add ``__repr__`` for variants to return a string representation of the raw data without spewing megabytes of text (:user:`chriscrsmith`, :pr:`2695`, :issue:`2694`) -- Add ``keep_rows`` method to table classes to support efficient in-place - table subsetting (:user:`jeromekelleher`, :pr:`2700`) +**Breaking Changes** **Bugfixes** diff --git a/python/tests/test_metadata.py b/python/tests/test_metadata.py index b6c2ed664b..7387f73fad 100644 --- a/python/tests/test_metadata.py +++ b/python/tests/test_metadata.py @@ -322,7 +322,10 @@ def test_schema_str(self): "required": ["one", "two"], "additionalProperties": False, } - assert str(metadata.MetadataSchema(schema)) == pprint.pformat(schema) + assert ( + str(metadata.MetadataSchema(schema)) + == f"tskit.MetadataSchema(\n{pprint.pformat(schema)}\n)" + ) def test_register_codec(self): class TestCodec(metadata.AbstractMetadataCodec): diff --git a/python/tests/test_tables.py b/python/tests/test_tables.py index 7551f3250c..19fd0f104d 100644 --- a/python/tests/test_tables.py +++ b/python/tests/test_tables.py @@ -1396,7 +1396,7 @@ def test_metadata_schema(self, table_5row): table2.metadata_schema = tskit.MetadataSchema({"codec": "json"}) with pytest.raises( AssertionError, - match=f"{type(table_5row).__name__} metadata schemas differ:", + match=f"{type(table_5row).__name__} metadata schemas differ: ", ): table_5row.assert_equals(table2) table_5row.assert_equals(table2, ignore_metadata=True) @@ -4089,7 +4089,7 @@ def test_metadata_schema(self, t1, t2): t2.metadata_schema = tskit.MetadataSchema(None) with pytest.raises( AssertionError, - match=re.escape("Metadata schemas differ"), + match=re.escape("Metadata schemas differ:"), ): t1.assert_equals(t2) t1.assert_equals(t2, ignore_metadata=True) @@ -4193,7 +4193,7 @@ def test_ignore_reference_sequence(self, t1, t2): t2.reference_sequence.clear() with pytest.raises( AssertionError, - match=re.escape("Metadata schemas differ"), + match=re.escape("Metadata schemas differ: "), ): t1.assert_equals(t2) t1.assert_equals(t2, ignore_reference_sequence=True) diff --git a/python/tskit/metadata.py b/python/tskit/metadata.py index f9e8c0c6c7..81e23d0ecd 100644 --- a/python/tskit/metadata.py +++ b/python/tskit/metadata.py @@ -664,7 +664,14 @@ def __repr__(self) -> str: return self._string def __str__(self) -> str: - return pprint.pformat(self._schema) + if isinstance(self._schema, collections.OrderedDict): + s = pprint.pformat(dict(self._schema)) + else: + s = pprint.pformat(self._schema) + if "\n" in s: + return f"tskit.MetadataSchema(\n{s}\n)" + else: + return f"tskit.MetadataSchema({s})" def __eq__(self, other) -> bool: return self._string == other._string