diff --git a/Changelog.rst b/Changelog.rst index 3decded36c..8d86dc87f4 100644 --- a/Changelog.rst +++ b/Changelog.rst @@ -43,9 +43,11 @@ version NEXTVERSION (https://github.com/NCAS-CMS/cf-python/issues/828) * New dependency: ``h5netcdf>=1.3.0`` * New dependency: ``h5py>=3.10.0`` -* New dependency: ``s3fs>=2024.2.0`` +* New dependency: ``s3fs>=2024.6.0`` +* Changed dependency: ``numpy>=1.15,<2.0`` * Changed dependency: ``1.11.2.0<=cfdm<1.11.3.0`` * Changed dependency: ``cfunits>=3.3.7`` +* Changed dependency: ``dask>=2024.6.0,<=2024.7.1`` ---- diff --git a/cf/__init__.py b/cf/__init__.py index 9e630d86ea..419df85896 100644 --- a/cf/__init__.py +++ b/cf/__init__.py @@ -123,7 +123,7 @@ raise ImportError(_error0 + str(error1)) try: - import numpy + import numpy as np except ImportError as error1: raise ImportError(_error0 + str(error1)) @@ -191,10 +191,11 @@ # Check the version of numpy _minimum_vn = "1.22" -if Version(numpy.__version__) < Version(_minimum_vn): - raise RuntimeError( - f"Bad numpy version: cf requires numpy>={_minimum_vn}. " - f"Got {numpy.__version__} at {numpy.__file__}" +_maximum_vn = "2.0" +if not Version(_minimum_vn) <= Version(np.__version__) < Version(_maximum_vn): + raise ValueError( + "Bad numpy version: cf requires _minimum_vn}<=numpy<{_maximum_vn}. " + f"Got {np.__version__} at {np.__file__}" ) # Check the version of cfunits @@ -208,15 +209,31 @@ # Check the version of cfdm _minimum_vn = "1.11.2.0" _maximum_vn = "1.11.3.0" -_cfdm_version = Version(cfdm.__version__) -if not Version(_minimum_vn) <= _cfdm_version < Version(_maximum_vn): +if ( + not Version(_minimum_vn) + <= Version(cfdm.__version__) + < Version(_maximum_vn) +): raise RuntimeError( f"Bad cfdm version: cf requires {_minimum_vn}<=cfdm<{_maximum_vn}. " - f"Got {_cfdm_version} at {cfdm.__file__}" + f"Got {cfdm.__version__} at {cfdm.__file__}" ) # Check the version of dask +# Check the version of numpy +_minimum_vn = "2024.6.1" +_maximum_vn = "2024.7.1" +if ( + not Version(_minimum_vn) + <= Version(dask.__version__) + <= Version(_maximum_vn) +): + raise ValueError( + "Bad dask version: cf requires {_minimum_vn}<=dask<={_maximum_vn}. " + f"Got {dask.__version__} at {dask.__file__}" + ) + # Check the version of Python _minimum_vn = "3.8.0" if Version(platform.python_version()) < Version(_minimum_vn): @@ -233,6 +250,8 @@ f"Got {scipy.__version__} at {scipy.__file__}" ) +del _minimum_vn, _maximum_vn + from .constructs import Constructs from .mixin import Coordinate diff --git a/docs/source/installation.rst b/docs/source/installation.rst index 601fc487fc..a39acd77d6 100644 --- a/docs/source/installation.rst +++ b/docs/source/installation.rst @@ -192,9 +192,11 @@ Required * `Python `_, 3.8.0 or newer. -* `numpy `_, 1.22.0 or newer. +* `numpy `_, versions 1.15 up to, but not + including, 2.0. -* `dask `_, 2022.12.1 or newer. +* `dask `_, versions 2024.6.0 to + 2024.7.1 inclusive. * `netCDF4 `_, 1.6.5 or newer. @@ -206,7 +208,7 @@ Required * `h5py `_, version 3.10.0 or newer. -* `s3fs `_, version 2024.2.0 or newer. +* `s3fs `_, version 2024.6.0 or newer. * `scipy `_, version 1.10.0 or newer. diff --git a/requirements.txt b/requirements.txt index 8b01daddca..94886c0d57 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,12 +1,12 @@ netCDF4>=1.6.5 cftime>=1.6.2 -numpy>=1.22 +numpy>=1.22,<2.0 cfdm>=1.11.2.0, <1.11.3.0 psutil>=0.6.0 cfunits>=3.3.7 -dask>=2024.4.0 +dask>=2024.6.0,<=2024.7.1 packaging>=20.0 scipy>=1.10.0 h5netcdf>=1.3.0 h5py>=3.10.0 -s3fs>=2024.2.0 +s3fs>=2024.6.0