From 001a3dcc578377037941b60b3ffd8d9b1595fc2a Mon Sep 17 00:00:00 2001 From: Vecko <36369090+VeckoTheGecko@users.noreply.github.com> Date: Tue, 26 Nov 2024 00:24:21 +0800 Subject: [PATCH 1/2] Rename fieldfilebuffer -> _... --- parcels/{fieldfilebuffer.py => _fieldfilebuffer.py} | 0 parcels/field.py | 2 +- tests/test_fieldset.py | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) rename parcels/{fieldfilebuffer.py => _fieldfilebuffer.py} (100%) diff --git a/parcels/fieldfilebuffer.py b/parcels/_fieldfilebuffer.py similarity index 100% rename from parcels/fieldfilebuffer.py rename to parcels/_fieldfilebuffer.py diff --git a/parcels/field.py b/parcels/field.py index 17f67eb0d..ecc2a92c2 100644 --- a/parcels/field.py +++ b/parcels/field.py @@ -37,7 +37,7 @@ ) from parcels.tools.warnings import FieldSetWarning, _deprecated_param_netcdf_decodewarning -from .fieldfilebuffer import ( +from ._fieldfilebuffer import ( DaskFileBuffer, DeferredDaskFileBuffer, DeferredNetcdfFileBuffer, diff --git a/tests/test_fieldset.py b/tests/test_fieldset.py index 1c43493c5..36fcd5c01 100644 --- a/tests/test_fieldset.py +++ b/tests/test_fieldset.py @@ -23,8 +23,8 @@ TimeExtrapolationError, Variable, ) +from parcels._fieldfilebuffer import DaskFileBuffer from parcels.field import Field, VectorField -from parcels.fieldfilebuffer import DaskFileBuffer from parcels.tools.converters import ( GeographicPolar, TimeConverter, 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 2/2] 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, + )