From f6d0874b25e10c0817132bdff404ad87b00e7d9c Mon Sep 17 00:00:00 2001 From: "William (Zhiyi) Wu" Date: Fri, 9 Dec 2022 18:05:36 +0000 Subject: [PATCH 1/7] update --- CHANGES | 1 + src/alchemlyb/estimators/mbar_.py | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/CHANGES b/CHANGES index cee14a6a..65463223 100644 --- a/CHANGES +++ b/CHANGES @@ -18,6 +18,7 @@ The rules for this file: * 1.0.1 Enhancements + - Add DeprecationWarning to AutoMBAR (issue #284, PR #285). - Blackfy the codebase (PR #280). - Refactor the test to make all the parsing done at conftest level (issue #206, PR #278). diff --git a/src/alchemlyb/estimators/mbar_.py b/src/alchemlyb/estimators/mbar_.py index 4759d687..720b6190 100644 --- a/src/alchemlyb/estimators/mbar_.py +++ b/src/alchemlyb/estimators/mbar_.py @@ -1,4 +1,5 @@ import logging +from warnings import warn import pandas as pd import pymbar @@ -210,6 +211,10 @@ def __init__( verbose=False, method=None, ): + warn( + "From version 2.0.0, this will be replaced by the default alchemlyb.estimators.MBAR.", + DeprecationWarning, + ) super().__init__( maximum_iterations=maximum_iterations, relative_tolerance=relative_tolerance, From cbf2c476026e24cb7992dae25d71bc6a166c01e2 Mon Sep 17 00:00:00 2001 From: "William (Zhiyi) Wu" Date: Fri, 9 Dec 2022 19:18:33 +0000 Subject: [PATCH 2/7] update --- src/alchemlyb/estimators/mbar_.py | 2 ++ src/alchemlyb/tests/test_fep_estimators.py | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/src/alchemlyb/estimators/mbar_.py b/src/alchemlyb/estimators/mbar_.py index 720b6190..ecd1fc62 100644 --- a/src/alchemlyb/estimators/mbar_.py +++ b/src/alchemlyb/estimators/mbar_.py @@ -201,6 +201,8 @@ class AutoMBAR(MBAR): .. versionadded:: 0.6.0 .. versionchanged:: 1.0.0 AutoMBAR accepts the `method` argument. + .. deprecated:: 1.0.1 + Deprecate AutoMBAR in favour of MBAR for pymbar4. """ def __init__( diff --git a/src/alchemlyb/tests/test_fep_estimators.py b/src/alchemlyb/tests/test_fep_estimators.py index 9d041eb8..9c40a22e 100644 --- a/src/alchemlyb/tests/test_fep_estimators.py +++ b/src/alchemlyb/tests/test_fep_estimators.py @@ -55,6 +55,14 @@ def test_mbar(self, X_delta_f): class TestAutoMBAR(TestMBAR): cls = AutoMBAR + def test_autombar(self, X_delta_f): + with pytest.warn( + DeprecationWarning( + "From version 2.0.0, this will be replaced by the default alchemlyb.estimators.MBAR." + ) + ): + self.compare_delta_f(X_delta_f) + class TestMBAR_fail: def test_failback_adaptive(self, gmx_ABFE_complex_n_uk): From 2ce007d5d6b071a2f3276d4a26d9f39f33206486 Mon Sep 17 00:00:00 2001 From: "William (Zhiyi) Wu" Date: Fri, 9 Dec 2022 19:25:28 +0000 Subject: [PATCH 3/7] update --- src/alchemlyb/tests/test_fep_estimators.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/alchemlyb/tests/test_fep_estimators.py b/src/alchemlyb/tests/test_fep_estimators.py index 9c40a22e..c6d8e4b7 100644 --- a/src/alchemlyb/tests/test_fep_estimators.py +++ b/src/alchemlyb/tests/test_fep_estimators.py @@ -56,11 +56,7 @@ class TestAutoMBAR(TestMBAR): cls = AutoMBAR def test_autombar(self, X_delta_f): - with pytest.warn( - DeprecationWarning( - "From version 2.0.0, this will be replaced by the default alchemlyb.estimators.MBAR." - ) - ): + with pytest.deprecated_call(): self.compare_delta_f(X_delta_f) From fba9e8cfb8c1cdc66f5776f6c0cf91eb7a707fab Mon Sep 17 00:00:00 2001 From: Oliver Beckstein Date: Fri, 9 Dec 2022 14:33:19 -0700 Subject: [PATCH 4/7] Update src/alchemlyb/estimators/mbar_.py --- src/alchemlyb/estimators/mbar_.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/alchemlyb/estimators/mbar_.py b/src/alchemlyb/estimators/mbar_.py index ecd1fc62..001e85b9 100644 --- a/src/alchemlyb/estimators/mbar_.py +++ b/src/alchemlyb/estimators/mbar_.py @@ -202,7 +202,8 @@ class AutoMBAR(MBAR): .. versionchanged:: 1.0.0 AutoMBAR accepts the `method` argument. .. deprecated:: 1.0.1 - Deprecate AutoMBAR in favour of MBAR for pymbar4. + Deprecate AutoMBAR in favour of MBAR for pymbar4. It will be removed + in alchemlyb 2.0.0. """ def __init__( From d423cab45a8e08f329e341d5e3e6243c77182bda Mon Sep 17 00:00:00 2001 From: "William (Zhiyi) Wu" Date: Fri, 9 Dec 2022 22:58:12 +0000 Subject: [PATCH 5/7] update --- src/alchemlyb/tests/__init__.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/alchemlyb/tests/__init__.py b/src/alchemlyb/tests/__init__.py index e69de29b..3ae53463 100644 --- a/src/alchemlyb/tests/__init__.py +++ b/src/alchemlyb/tests/__init__.py @@ -0,0 +1,7 @@ +import warnings + +warnings.filterwarnings( + "ignore", + "From version 2.0.0, this will be replaced by the default alchemlyb.estimators.MBAR.", + category=DeprecationWarning, +) From 297184892f2819e3d8dcdc40a4d347cf74287bbd Mon Sep 17 00:00:00 2001 From: "William (Zhiyi) Wu" Date: Fri, 9 Dec 2022 23:07:32 +0000 Subject: [PATCH 6/7] fix --- src/alchemlyb/tests/__init__.py | 7 ------- src/alchemlyb/tests/pytest.ini | 3 +++ 2 files changed, 3 insertions(+), 7 deletions(-) create mode 100644 src/alchemlyb/tests/pytest.ini diff --git a/src/alchemlyb/tests/__init__.py b/src/alchemlyb/tests/__init__.py index 3ae53463..e69de29b 100644 --- a/src/alchemlyb/tests/__init__.py +++ b/src/alchemlyb/tests/__init__.py @@ -1,7 +0,0 @@ -import warnings - -warnings.filterwarnings( - "ignore", - "From version 2.0.0, this will be replaced by the default alchemlyb.estimators.MBAR.", - category=DeprecationWarning, -) diff --git a/src/alchemlyb/tests/pytest.ini b/src/alchemlyb/tests/pytest.ini new file mode 100644 index 00000000..9bef1a95 --- /dev/null +++ b/src/alchemlyb/tests/pytest.ini @@ -0,0 +1,3 @@ +[pytest] +filterwarnings = + ignore:*alchemlyb.estimators.MBAR.:DeprecationWarning: \ No newline at end of file From ee67283623c56a46b1affdc5a33a23f864694b83 Mon Sep 17 00:00:00 2001 From: "William (Zhiyi) Wu" Date: Fri, 9 Dec 2022 23:15:04 +0000 Subject: [PATCH 7/7] update --- src/alchemlyb/tests/pytest.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/alchemlyb/tests/pytest.ini b/src/alchemlyb/tests/pytest.ini index 9bef1a95..fa6b641f 100644 --- a/src/alchemlyb/tests/pytest.ini +++ b/src/alchemlyb/tests/pytest.ini @@ -1,3 +1,3 @@ [pytest] filterwarnings = - ignore:*alchemlyb.estimators.MBAR.:DeprecationWarning: \ No newline at end of file + ignore:From version 2.0.0, this will be replaced by the default alchemlyb.estimators.MBAR.:DeprecationWarning: \ No newline at end of file