diff --git a/CHANGELOG.rst b/CHANGELOG.rst index a6369bf9..7a58497e 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -12,6 +12,7 @@ New features Internal changes ^^^^^^^^^^^^^^^^ * `pydap` has been pinned below v3.5.5 temporarily until `xarray` offers support for it. (PR #486). +* More than 7500 DeprecationWarnings emitted during the testing suite have been addressed. Minimum supported `pydantic` has been raised to v2.11. (PR #487). v0.18.0 (2025-04-03) -------------------- diff --git a/environment-dev.yml b/environment-dev.yml index 53442ad7..2c058ebb 100644 --- a/environment-dev.yml +++ b/environment-dev.yml @@ -23,7 +23,7 @@ dependencies: - pandas >=2.2.0 - pint >=0.24.4 - platformdirs >=4.3.6 - - pydantic >=2.0 + - pydantic >=2.11 - pydap >=3.4.0,<3.5.5 # pydap 3.5.5 is not currently supported by `xarray` (v2025.3.1) - pymetalink >=6.5.2 - pymbolic >=2024.2 diff --git a/environment-docs.yml b/environment-docs.yml index 88383d81..c680058d 100644 --- a/environment-docs.yml +++ b/environment-docs.yml @@ -31,7 +31,7 @@ dependencies: - netCDF4 >=1.7.2 - numpy >=1.24.0 - notebook - - pydantic >=2.0 + - pydantic >=2.11 - pymetalink >=6.5.2 - s3fs - salib diff --git a/pyproject.toml b/pyproject.toml index cae6d918..ecede85c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -49,7 +49,7 @@ dependencies = [ "pandas >=2.2.0", "pint >=0.24.4", "platformdirs >=4.3.6", - "pydantic >=2.0", + "pydantic >=2.11", "pydap >=3.4.0,<3.5.5", # pydap 3.5.5 is not currently supported by `xarray` (v2025.3.1) "pymbolic >=2024.2", "scipy >=1.11.0", diff --git a/src/ravenpy/config/base.py b/src/ravenpy/config/base.py index 3bc46716..585b9085 100644 --- a/src/ravenpy/config/base.py +++ b/src/ravenpy/config/base.py @@ -144,7 +144,8 @@ def __subcommands__(self) -> tuple[dict[str, str], list]: """Return dictionary of class attributes that are Raven models.""" cmds = {} recs = [] - for key, field in self.model_fields.items(): + cls = self.__class__ + for key, field in cls.model_fields.items(): obj = self.__dict__[key] if obj is not None: if issubclass(obj.__class__, _Record): @@ -225,8 +226,9 @@ class LineCommand(FlatCommand): """ def to_rv(self): - out = [f":{self.__class__.__name__:<20}"] - for field in self.model_fields.keys(): + cls = self.__class__ + out = [f":{cls.__name__:<20}"] + for field in cls.model_fields.keys(): out.append(str(getattr(self, field))) # noqa: PERF401 return " ".join(out) + "\n" diff --git a/tests/test_rvs.py b/tests/test_rvs.py index c59589eb..d142cbb0 100644 --- a/tests/test_rvs.py +++ b/tests/test_rvs.py @@ -18,7 +18,7 @@ class Test(RV): a: bool = optfield(alias="a") t = Test() - assert not t.model_fields["a"].is_required() + assert not t.__class__.model_fields["a"].is_required() def test_rvi_datetime():