Repository: modin-project/modin

Issue:
NumPy 2.0 support
Planned release with NumPy>=2.0 support: 0.31.0.

There is not much left to do to achieve this. Fix the imports in the `modin.numpy` module (according https://github.com/modin-project/modin/pull/7301/files).


Discussion:

Resolving patch:
diff --git a/modin/numpy/__init__.py b/modin/numpy/__init__.py
--- a/modin/numpy/__init__.py
+++ b/modin/numpy/__init__.py
@@ -11,27 +11,28 @@
 # ANY KIND, either express or implied. See the License for the specific language
 # governing permissions and limitations under the License.
 
+import numpy
+from packaging import version
+
 from . import linalg
 from .arr import array
 from .array_creation import ones_like, tri, zeros_like
 from .array_shaping import append, hstack, ravel, shape, split, transpose
-from .constants import (
-    NAN,
-    NINF,
-    NZERO,
-    PINF,
-    PZERO,
-    Inf,
-    Infinity,
-    NaN,
-    e,
-    euler_gamma,
-    inf,
-    infty,
-    nan,
-    newaxis,
-    pi,
-)
+from .constants import e, euler_gamma, inf, nan, newaxis, pi
+
+if version.parse(numpy.__version__) < version.parse("2.0.0b1"):
+    from .constants import (
+        NAN,
+        NINF,
+        NZERO,
+        PINF,
+        PZERO,
+        Inf,
+        Infinity,
+        NaN,
+        infty,
+    )
+
 from .logic import (
     all,
     any,
@@ -151,18 +152,9 @@ def where(condition, x=None, y=None):
     "amin",
     "min",
     "where",
-    "Inf",
-    "Infinity",
-    "NAN",
-    "NINF",
-    "NZERO",
-    "NaN",
-    "PINF",
-    "PZERO",
     "e",
     "euler_gamma",
     "inf",
-    "infty",
     "nan",
     "newaxis",
     "pi",
@@ -177,3 +169,15 @@ def where(condition, x=None, y=None):
     "append",
     "tri",
 ]
+if version.parse(numpy.__version__) < version.parse("2.0.0b1"):
+    __all__ += [
+        "Inf",
+        "Infinity",
+        "NAN",
+        "NINF",
+        "NZERO",
+        "NaN",
+        "PINF",
+        "PZERO",
+        "infty",
+    ]
diff --git a/modin/numpy/constants.py b/modin/numpy/constants.py
--- a/modin/numpy/constants.py
+++ b/modin/numpy/constants.py
@@ -11,39 +11,31 @@
 # ANY KIND, either express or implied. See the License for the specific language
 # governing permissions and limitations under the License.
 
-# flake8: noqa
-from numpy import (
-    NAN,
-    NINF,
-    NZERO,
-    PINF,
-    PZERO,
-    Inf,
-    Infinity,
-    NaN,
-    e,
-    euler_gamma,
-    inf,
-    infty,
-    nan,
-    newaxis,
-    pi,
-)
+import numpy
+from numpy import e, euler_gamma, inf, nan, newaxis, pi
+from packaging import version
+
+if version.parse(numpy.__version__) < version.parse("2.0.0b1"):
+    from numpy import NAN, NINF, NZERO, PINF, PZERO, Inf, Infinity, NaN, infty
 
 __all__ = [
-    "Inf",
-    "Infinity",
-    "NAN",
-    "NINF",
-    "NZERO",
-    "NaN",
-    "PINF",
-    "PZERO",
     "e",
     "euler_gamma",
     "inf",
-    "infty",
     "nan",
     "newaxis",
     "pi",
 ]
+
+if version.parse(numpy.__version__) < version.parse("2.0.0b1"):
+    __all__ += [
+        "Inf",
+        "Infinity",
+        "NAN",
+        "NINF",
+        "NZERO",
+        "NaN",
+        "PINF",
+        "PZERO",
+        "infty",
+    ]


Test patch: