Skip to content

Commit a893769

Browse files
authored
deprecate AutoMBAR (PR #285)
- fix #284 - Deprecate AutoMBAR (for removal in 2.0.0) - test DeprecationWarning - silence this warning otherwise - update docs - update CHANGES
1 parent 98487f8 commit a893769

File tree

4 files changed

+19
-0
lines changed

4 files changed

+19
-0
lines changed

CHANGES

+4
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ Fixes
2727
there are no spaces around the equal sign (issue #272, PR #273).
2828
- Pre-processing function slicing will not drop NaN rows (issue
2929
#274, PR #275).
30+
31+
Deprecations
32+
- deprecate AutoMBAR for removal in 2.0 because pymbar 4 already contains
33+
equivalent functionality (issue #284, PR #285).
3034

3135
Internal Enhancements (do not affect API)
3236
- Blackfy the codebase (PR #280).

src/alchemlyb/estimators/mbar_.py

+8
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import logging
2+
from warnings import warn
23

34
import pandas as pd
45
import pymbar
@@ -200,6 +201,9 @@ class AutoMBAR(MBAR):
200201
.. versionadded:: 0.6.0
201202
.. versionchanged:: 1.0.0
202203
AutoMBAR accepts the `method` argument.
204+
.. deprecated:: 1.0.1
205+
Deprecate AutoMBAR in favour of MBAR for pymbar4. It will be removed
206+
in alchemlyb 2.0.0.
203207
"""
204208

205209
def __init__(
@@ -210,6 +214,10 @@ def __init__(
210214
verbose=False,
211215
method=None,
212216
):
217+
warn(
218+
"From version 2.0.0, this will be replaced by the default alchemlyb.estimators.MBAR.",
219+
DeprecationWarning,
220+
)
213221
super().__init__(
214222
maximum_iterations=maximum_iterations,
215223
relative_tolerance=relative_tolerance,

src/alchemlyb/tests/pytest.ini

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[pytest]
2+
filterwarnings =
3+
ignore:From version 2.0.0, this will be replaced by the default alchemlyb.estimators.MBAR.:DeprecationWarning:

src/alchemlyb/tests/test_fep_estimators.py

+4
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ def test_mbar(self, X_delta_f):
5555
class TestAutoMBAR(TestMBAR):
5656
cls = AutoMBAR
5757

58+
def test_autombar(self, X_delta_f):
59+
with pytest.deprecated_call():
60+
self.compare_delta_f(X_delta_f)
61+
5862

5963
class TestMBAR_fail:
6064
def test_failback_adaptive(self, gmx_ABFE_complex_n_uk):

0 commit comments

Comments
 (0)