From a30af007b0ada433bb43c4ee161d12493538e97d Mon Sep 17 00:00:00 2001 From: Vecko <36369090+VeckoTheGecko@users.noreply.github.com> Date: Tue, 26 Nov 2024 00:26:24 +0800 Subject: [PATCH] Deprecation warning for `fieldfilebuffer` --- parcels/fieldfilebuffer.py | 13 +++++++++++++ tests/test_deprecations.py | 10 ++++++++++ 2 files changed, 23 insertions(+) create mode 100644 parcels/fieldfilebuffer.py diff --git a/parcels/fieldfilebuffer.py b/parcels/fieldfilebuffer.py new file mode 100644 index 000000000..d968ec5ca --- /dev/null +++ b/parcels/fieldfilebuffer.py @@ -0,0 +1,13 @@ +import warnings + +from parcels._fieldfilebuffer import DaskFileBuffer, DeferredDaskFileBuffer, NetcdfFileBuffer, _FileBuffer + +__all__ = ["DaskFileBuffer", "DeferredDaskFileBuffer", "NetcdfFileBuffer", "_FileBuffer"] + +warnings.warn( + "The `parcels.fieldfilebuffer` module is deprecated as it has been marked private. " + "Users are not expected to use it in their scripts. See https://github.com/OceanParcels/Parcels/issues/1773 " + "to continue discussion.", + DeprecationWarning, + stacklevel=2, +) # TODO: Remove 6 months after v3.1.1 diff --git a/tests/test_deprecations.py b/tests/test_deprecations.py index f75b85b57..6901eff05 100644 --- a/tests/test_deprecations.py +++ b/tests/test_deprecations.py @@ -411,3 +411,13 @@ def test_removed_attrib(removed_attribute_action: Action): with pytest.raises(AttributeError): getattr(obj, action.public_name) + + +def test_private_fieldfilebuffer(): + with pytest.warns(DeprecationWarning): + from parcels.fieldfilebuffer import ( # noqa: F401 + DaskFileBuffer, + DeferredDaskFileBuffer, + NetcdfFileBuffer, + _FileBuffer, + )