From a40f0f084959dae7373fe76a0f92d351811b862d Mon Sep 17 00:00:00 2001 From: Meher Gajula <64327181+me-her@users.noreply.github.com> Date: Mon, 16 Dec 2024 15:26:15 -0600 Subject: [PATCH 1/8] Update pyproject.toml - zfpy Versioning Zfpy release 1.0.1 which supports numpy > 2.0. --- pyproject.toml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 52ab34c3..7877088f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -63,8 +63,7 @@ msgpack = [ "msgpack", ] zfpy = [ - "zfpy>=1.0.0", - "numpy<2.0.0", + "zfpy>=1.0.0" ] pcodec = [ "pcodec>=0.3,<0.4", From 5dc9edb498094467c2e453f94d3de688ee108ad5 Mon Sep 17 00:00:00 2001 From: Meher Gajula <64327181+me-her@users.noreply.github.com> Date: Mon, 16 Dec 2024 15:31:57 -0600 Subject: [PATCH 2/8] Removing numpy verison warning from zfpy --- numcodecs/zfpy.py | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/numcodecs/zfpy.py b/numcodecs/zfpy.py index eda4bfc2..9d5ed940 100644 --- a/numcodecs/zfpy.py +++ b/numcodecs/zfpy.py @@ -11,19 +11,8 @@ _zfpy_version = tuple(map(int, version("zfpy").split("."))) if _zfpy_version: - # Check NumPy version - _numpy_version: tuple = tuple(map(int, version("numpy").split('.'))) - if _numpy_version >= (2, 0, 0) and _zfpy_version <= (1, 0, 1): # pragma: no cover - _zfpy_version = () - warnings.warn( - "NumPy version >= 2.0.0 detected. The zfpy library is incompatible with this version of NumPy. " - "Please downgrade to NumPy < 2.0.0 or wait for an update from zfpy.", - UserWarning, - stacklevel=2, - ) - else: - with suppress(ImportError): - import zfpy as _zfpy # type: ignore[no-redef] + with suppress(ImportError): + import zfpy as _zfpy if _zfpy: import numpy as np From 55972092fda7b016f6ceed7f47bfb9597a32085e Mon Sep 17 00:00:00 2001 From: Meher Gajula <64327181+me-her@users.noreply.github.com> Date: Mon, 16 Dec 2024 15:52:04 -0600 Subject: [PATCH 3/8] Removing unused imports. --- numcodecs/zfpy.py | 1 - 1 file changed, 1 deletion(-) diff --git a/numcodecs/zfpy.py b/numcodecs/zfpy.py index 9d5ed940..ff631c82 100644 --- a/numcodecs/zfpy.py +++ b/numcodecs/zfpy.py @@ -1,4 +1,3 @@ -import warnings from contextlib import suppress from importlib.metadata import PackageNotFoundError, version from types import ModuleType From bfc8a7e8e994b66c8b33714dcb684a6c5f6d0c95 Mon Sep 17 00:00:00 2001 From: Meher Gajula <64327181+me-her@users.noreply.github.com> Date: Mon, 16 Dec 2024 16:15:11 -0600 Subject: [PATCH 4/8] precommit fix --- numcodecs/zfpy.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/numcodecs/zfpy.py b/numcodecs/zfpy.py index ff631c82..1b817024 100644 --- a/numcodecs/zfpy.py +++ b/numcodecs/zfpy.py @@ -11,7 +11,7 @@ if _zfpy_version: with suppress(ImportError): - import zfpy as _zfpy + import zfpy as _zfpy # type: ignore[no-redef] if _zfpy: import numpy as np From dee4aa9b685b9f72be71c2537a9134312d432887 Mon Sep 17 00:00:00 2001 From: Meher Gajula <64327181+me-her@users.noreply.github.com> Date: Mon, 16 Dec 2024 16:30:16 -0600 Subject: [PATCH 5/8] precommit --- numcodecs/zfpy.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/numcodecs/zfpy.py b/numcodecs/zfpy.py index 1b817024..dc71dc4f 100644 --- a/numcodecs/zfpy.py +++ b/numcodecs/zfpy.py @@ -11,7 +11,7 @@ if _zfpy_version: with suppress(ImportError): - import zfpy as _zfpy # type: ignore[no-redef] + import zfpy as _zfpy # type: ignore[no-redef] if _zfpy: import numpy as np From f9e98ef3d9f7e8d8c9fa2d972e9d1656d855720c Mon Sep 17 00:00:00 2001 From: Meher Gajula <64327181+me-her@users.noreply.github.com> Date: Tue, 17 Dec 2024 09:51:05 -0600 Subject: [PATCH 6/8] Updated Changelog --- docs/release.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/release.rst b/docs/release.rst index 68a751d3..a5ecfe19 100644 --- a/docs/release.rst +++ b/docs/release.rst @@ -28,6 +28,10 @@ Fixes * Fixes issue with ``Delta`` Zarr 3 codec not working with ``astype``. By :user:`Norman Rzepka `, :issue:`664` +* Removed Version Check: The previous code included a check for the `NumPy` version + and a warning if the version was incompatible with `zfpy`. + This check has been removed because `zfpy` now supports the newer versions of `NumPy`. + By :user:`Meher Gajula `, :issue:`672` Improvements ~~~~~~~~~~~~ From e19768eb831fff3f46bb10cafd311d95c80fff6b Mon Sep 17 00:00:00 2001 From: Meher Gajula <64327181+me-her@users.noreply.github.com> Date: Wed, 18 Dec 2024 09:31:31 -0600 Subject: [PATCH 7/8] Precommit changes. --- docs/release.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/release.rst b/docs/release.rst index a5ecfe19..c4fe4db0 100644 --- a/docs/release.rst +++ b/docs/release.rst @@ -28,7 +28,7 @@ Fixes * Fixes issue with ``Delta`` Zarr 3 codec not working with ``astype``. By :user:`Norman Rzepka `, :issue:`664` -* Removed Version Check: The previous code included a check for the `NumPy` version +* Removed Version Check: The previous code included a check for the `NumPy` version and a warning if the version was incompatible with `zfpy`. This check has been removed because `zfpy` now supports the newer versions of `NumPy`. By :user:`Meher Gajula `, :issue:`672` From 4976a2944188fea85b5703032238328c72b94698 Mon Sep 17 00:00:00 2001 From: Meher Gajula <64327181+me-her@users.noreply.github.com> Date: Sat, 28 Dec 2024 10:57:25 -0600 Subject: [PATCH 8/8] Version check for zfpy lower than 1.0.1 --- numcodecs/zfpy.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/numcodecs/zfpy.py b/numcodecs/zfpy.py index dc71dc4f..831952a5 100644 --- a/numcodecs/zfpy.py +++ b/numcodecs/zfpy.py @@ -1,3 +1,4 @@ +import warnings from contextlib import suppress from importlib.metadata import PackageNotFoundError, version from types import ModuleType @@ -10,8 +11,19 @@ _zfpy_version = tuple(map(int, version("zfpy").split("."))) if _zfpy_version: - with suppress(ImportError): - import zfpy as _zfpy # type: ignore[no-redef] + # Check NumPy version + _numpy_version: tuple = tuple(map(int, version("numpy").split('.'))) + if _numpy_version >= (2, 0, 0) and _zfpy_version < (1, 0, 1): # pragma: no cover + _zfpy_version = () + warnings.warn( + "NumPy version >= 2.0.0 detected. The zfpy library is incompatible with this version of NumPy. " + "Please downgrade to NumPy < 2.0.0 or wait for an update from zfpy.", + UserWarning, + stacklevel=2, + ) + else: + with suppress(ImportError): + import zfpy as _zfpy # type: ignore[no-redef] if _zfpy: import numpy as np