summaryrefslogtreecommitdiff
path: root/dev-python/numpy
diff options
context:
space:
mode:
authorroot <root@alpha.trunkmasters.com>2026-06-12 19:09:37 -0500
committerroot <root@alpha.trunkmasters.com>2026-06-12 19:09:37 -0500
commitb590c8d7572b727d565cc0b8ff660d43569845de (patch)
tree06f7a4102ea4e845df8b66660f252920d52952f9 /dev-python/numpy
parent24f9cbfc4c34fdb6a6e03311674414e881ceab47 (diff)
downloadbaldeagleos-repo-b590c8d7572b727d565cc0b8ff660d43569845de.tar.gz
baldeagleos-repo-b590c8d7572b727d565cc0b8ff660d43569845de.tar.xz
baldeagleos-repo-b590c8d7572b727d565cc0b8ff660d43569845de.zip
Adding metadataHEADdevelop
Diffstat (limited to 'dev-python/numpy')
-rw-r--r--dev-python/numpy/Manifest9
-rw-r--r--dev-python/numpy/files/numpy-2.2.5-py314.patch298
-rw-r--r--dev-python/numpy/files/numpy-2.2.6-gcc16.patch14
-rw-r--r--dev-python/numpy/metadata.xml32
-rw-r--r--dev-python/numpy/numpy-2.2.6.ebuild205
-rw-r--r--dev-python/numpy/numpy-2.4.4.ebuild315
-rw-r--r--dev-python/numpy/numpy-2.4.5.ebuild329
-rw-r--r--dev-python/numpy/numpy-2.4.6.ebuild329
-rw-r--r--dev-python/numpy/numpy-2.5.0_rc1.ebuild329
9 files changed, 1860 insertions, 0 deletions
diff --git a/dev-python/numpy/Manifest b/dev-python/numpy/Manifest
new file mode 100644
index 000000000000..d59136a4a550
--- /dev/null
+++ b/dev-python/numpy/Manifest
@@ -0,0 +1,9 @@
+DIST numpy-2.2.6.tar.gz 20276440 BLAKE2B 597ebbc72b2b3901bba4e0946f4f63ff13baf3b04d2f44d6e1ce8d05112f5d7191cb2e2f80e20006f0bc57a5a3f395fcc6003d9593e41b057394c12ad44f69f7 SHA512 00c82476c6cc8e68c4cd3210896172d91bdb52a46676931d173a3bbd772b29cebc8e819dfbbaf621eba9225fff3fa3f81426fe864d8812de4ff2975e7ac5c338
+DIST numpy-2.4.4.tar.gz 20731587 BLAKE2B 0cfa06b9a471e1a54a222f98f660b49e893fef65416d1da724c66811281e658cf0a5df4ad5e82296c2dbd9eee7ce97bbf5780bcd21022c7af515f5afe1763504 SHA512 7abec48faf957449248194683aaf2d97c2424ab9ab22cfa6e6676e79185da4ad971839f24b73c8576e582f91e7d941a8fc2b1550ee84b26d8ee6273d1009deee
+DIST numpy-2.4.4.tar.gz.provenance 9927 BLAKE2B 878acd595cb1bdce337bb1c9058583494df25b8f5d3f515c8f1d64b2b58446390b6b52b5fdd91a42a50d8fd49f420e2ed9e47bfc56c2c213391482e663015e26 SHA512 b20a603fa02973315eb2a40db2573b8b346e0729c3e4a1a8dd1e7bc0f0bb1be3b5b3a5a10372fda8a423ea0988cfe4a292f5c4ea8a1401f4bba288d650bbe2f8
+DIST numpy-2.4.5.tar.gz 20735669 BLAKE2B 93a3484f39974893c34cc51f6073e3f1c1a4bf4488acc133f84d668819744090d2e355b4d6a20159e985b3b3ebe4beb15746c881f1f252f31e3ab5ccd5865651 SHA512 f490da5549070afe74d729aef5dd9af5dfd2f0e40f40ae077aa67716ed6131116e82ef38a8153d78e6aff951bca3f0f519e02d53b796a8a20e886364c4156a58
+DIST numpy-2.4.5.tar.gz.provenance 9739 BLAKE2B 273d39dedf54f896f82e2cc6f1631282a0a0ac79c9c281d0935714879e949f3cb628f3b506a56e87a182cfff51c15c9c76dc4a20c1841278ff118260fe04d87f SHA512 52e0f67b2b8b379169a5486ec179026234d01fa96bcb604be6736f131d0423247be5a3b7be5aac9c7b2ea7df60e26c02cfe6949e211f150cc41d5017776e6328
+DIST numpy-2.4.6.tar.gz 20735807 BLAKE2B 8866cd9117365797a377278f0002930f0cae264bddbc9d0d7943907b6d54c80d7b0c7cc81263bfed0310e60754693c66d461ed7230ce457c30d9b6d3e50b27e7 SHA512 6e78c61a54bb89e202b0365440cef8f5dc948ac94eb39dfcd5af56a1ddce96ba8c7b4cd9b9c474be5f7642e7ec56cdc8eb238eb1871238911b94f9a90e2720ca
+DIST numpy-2.4.6.tar.gz.provenance 9880 BLAKE2B ecfe5e7b5d53ac975d3ff69b3ea463be4495f7759b63a92a455be8c29b66931707c4ca8dc0fa8296ced2182246738c935814932d31649a624fbfb06ceaafb76c SHA512 724b0cc27b8120b62ef1aae8c8ed673cd2bf4c430ddddf56ff1550f9d80ecfbc499f3df4c0a3370fecf19691eb3057e48057bd10d4d25a875a1f2f6a512e5c2f
+DIST numpy-2.5.0rc1.tar.gz 20610894 BLAKE2B f92c6ec4b7350aa806c07d131e87f4b8a3e68c8adb4dc634805ec9a66ddcefbf19e592ec024827cdb06a33f27ed6a44a7247b11a0d07a8ee94cdeb039b61eeea SHA512 7a0120682346e943120d01c3d14792d5ae167237942b85feedf9ec3ab91e927f9fd781f1f94c7b5fe3ae8d9111e29764e4e7a106981d9f048139a6fdbe8f2df2
+DIST numpy-2.5.0rc1.tar.gz.provenance 9967 BLAKE2B afd23bfe7721098fcda17ad52ff6e2dc85b16aaacf6ab6c515a2ffe09cd57f6f7593f38fef972a5a184c3598a61ab4e5d7fe36a3ce9aabf596cab02db565266d SHA512 ec6da12aa3f277f0a2c79e23552372ff3334b117f5ce19c02cd664e422b084a5401d87a58cbfb18197173da235babd8f01bee6d485f3553b2a59d4a279ae7e34
diff --git a/dev-python/numpy/files/numpy-2.2.5-py314.patch b/dev-python/numpy/files/numpy-2.2.5-py314.patch
new file mode 100644
index 000000000000..bdb0762e733c
--- /dev/null
+++ b/dev-python/numpy/files/numpy-2.2.5-py314.patch
@@ -0,0 +1,298 @@
+From 57084ae28ed14f3bba89ab51104dd5521b7edb64 Mon Sep 17 00:00:00 2001
+From: Nathan Goldbaum <nathan.goldbaum@gmail.com>
+Date: Tue, 22 Apr 2025 15:31:14 -0600
+Subject: [PATCH] ENH: Support Python 3.14 (#28748)
+
+* MNT: use CPython internal APIs to hotfix temporary elision on 3.14
+
+This is based on a diff from Sam Gross, see
+https://github.com/numpy/numpy/issues/28681#issuecomment-2810661401
+
+* TST: use refcount deltas in tests that hardcode refcounts
+
+* TST: one more refcount test change I don't understand
+
+* TST: fix ResourceWarning
+
+* CI: add 3.14 and 3.14t linux CI
+
+* CI: try with setup-python instead of setup-uv
+
+* CI: fix 3.14t-dev cython install
+
+* Update numpy/_core/src/multiarray/temp_elide.c
+
+Co-authored-by: Ross Barnowski <rossbar@caltech.edu>
+
+* CI: drop linux 3.13t smoke test
+
+* TST: move refcount check inside with block
+
+* MNT: guard against a possible future PyPy 3.14
+
+---------
+
+Co-authored-by: Ross Barnowski <rossbar@caltech.edu>
+
+MNT: add support for 3.14.0b1
+---
+ numpy/_core/src/multiarray/temp_elide.c | 19 +++++++++--
+ numpy/_core/tests/test_dlpack.py | 8 ++---
+ numpy/_core/tests/test_dtype.py | 3 +-
+ numpy/_core/tests/test_indexing.py | 6 ++--
+ numpy/_core/tests/test_item_selection.py | 8 +++--
+ numpy/_core/tests/test_multiarray.py | 4 ++-
+ numpy/_core/tests/test_nditer.py | 7 ++--
+ numpy/_core/tests/test_regression.py | 43 +++++++++++-------------
+ numpy/_core/tests/test_umath.py | 4 +--
+ 9 files changed, 62 insertions(+), 40 deletions(-)
+
+diff --git a/numpy/_core/src/multiarray/temp_elide.c b/numpy/_core/src/multiarray/temp_elide.c
+index 662a2fa52b..9236476c42 100644
+--- a/numpy/_core/src/multiarray/temp_elide.c
++++ b/numpy/_core/src/multiarray/temp_elide.c
+@@ -109,6 +109,19 @@ find_addr(void * addresses[], npy_intp naddr, void * addr)
+ return 0;
+ }
+
++static int
++check_unique_temporary(PyObject *lhs)
++{
++#if PY_VERSION_HEX == 0x030E00A7 && !defined(PYPY_VERSION)
++#error "NumPy is broken on CPython 3.14.0a7, please update to a newer version"
++#elif PY_VERSION_HEX >= 0x030E00B1 && !defined(PYPY_VERSION)
++ // see https://github.com/python/cpython/issues/133164
++ return PyUnstable_Object_IsUniqueReferencedTemporary(lhs);
++#else
++ return 1;
++#endif
++}
++
+ static int
+ check_callers(int * cannot)
+ {
+@@ -295,7 +308,8 @@ can_elide_temp(PyObject *olhs, PyObject *orhs, int *cannot)
+ !PyArray_CHKFLAGS(alhs, NPY_ARRAY_OWNDATA) ||
+ !PyArray_ISWRITEABLE(alhs) ||
+ PyArray_CHKFLAGS(alhs, NPY_ARRAY_WRITEBACKIFCOPY) ||
+- PyArray_NBYTES(alhs) < NPY_MIN_ELIDE_BYTES) {
++ PyArray_NBYTES(alhs) < NPY_MIN_ELIDE_BYTES ||
++ !check_unique_temporary(olhs)) {
+ return 0;
+ }
+ if (PyArray_CheckExact(orhs) ||
+@@ -372,7 +386,8 @@ can_elide_temp_unary(PyArrayObject * m1)
+ !PyArray_ISNUMBER(m1) ||
+ !PyArray_CHKFLAGS(m1, NPY_ARRAY_OWNDATA) ||
+ !PyArray_ISWRITEABLE(m1) ||
+- PyArray_NBYTES(m1) < NPY_MIN_ELIDE_BYTES) {
++ PyArray_NBYTES(m1) < NPY_MIN_ELIDE_BYTES ||
++ !check_unique_temporary((PyObject *)m1)) {
+ return 0;
+ }
+ if (check_callers(&cannot)) {
+diff --git a/numpy/_core/tests/test_dlpack.py b/numpy/_core/tests/test_dlpack.py
+index 41dd724295..d273bd798e 100644
+--- a/numpy/_core/tests/test_dlpack.py
++++ b/numpy/_core/tests/test_dlpack.py
+@@ -22,9 +22,9 @@ class TestDLPack:
+ def test_dunder_dlpack_refcount(self, max_version):
+ x = np.arange(5)
+ y = x.__dlpack__(max_version=max_version)
+- assert sys.getrefcount(x) == 3
++ startcount = sys.getrefcount(x)
+ del y
+- assert sys.getrefcount(x) == 2
++ assert startcount - sys.getrefcount(x) == 1
+
+ def test_dunder_dlpack_stream(self):
+ x = np.arange(5)
+@@ -58,9 +58,9 @@ def test_strides_not_multiple_of_itemsize(self):
+ def test_from_dlpack_refcount(self, arr):
+ arr = arr.copy()
+ y = np.from_dlpack(arr)
+- assert sys.getrefcount(arr) == 3
++ startcount = sys.getrefcount(arr)
+ del y
+- assert sys.getrefcount(arr) == 2
++ assert startcount - sys.getrefcount(arr) == 1
+
+ @pytest.mark.parametrize("dtype", [
+ np.bool,
+diff --git a/numpy/_core/tests/test_dtype.py b/numpy/_core/tests/test_dtype.py
+index deeca5171c..759eefeb2a 100644
+--- a/numpy/_core/tests/test_dtype.py
++++ b/numpy/_core/tests/test_dtype.py
+@@ -1901,9 +1901,10 @@ class mytype:
+ if HAS_REFCOUNT:
+ # Create an array and test that memory gets cleaned up (gh-25949)
+ o = object()
++ startcount = sys.getrefcount(o)
+ a = np.array([o], dtype=dt)
+ del a
+- assert sys.getrefcount(o) == 2
++ assert sys.getrefcount(o) == startcount
+
+ def test_custom_structured_dtype_errors(self):
+ class mytype:
+diff --git a/numpy/_core/tests/test_indexing.py b/numpy/_core/tests/test_indexing.py
+index f393c401cd..bb757cdf7e 100644
+--- a/numpy/_core/tests/test_indexing.py
++++ b/numpy/_core/tests/test_indexing.py
+@@ -1174,6 +1174,8 @@ def _compare_index_result(self, arr, index, mimic_get, no_copy):
+ """Compare mimicked result to indexing result.
+ """
+ arr = arr.copy()
++ if HAS_REFCOUNT:
++ startcount = sys.getrefcount(arr)
+ indexed_arr = arr[index]
+ assert_array_equal(indexed_arr, mimic_get)
+ # Check if we got a view, unless its a 0-sized or 0-d array.
+@@ -1184,9 +1186,9 @@ def _compare_index_result(self, arr, index, mimic_get, no_copy):
+ if HAS_REFCOUNT:
+ if no_copy:
+ # refcount increases by one:
+- assert_equal(sys.getrefcount(arr), 3)
++ assert_equal(sys.getrefcount(arr), startcount + 1)
+ else:
+- assert_equal(sys.getrefcount(arr), 2)
++ assert_equal(sys.getrefcount(arr), startcount)
+
+ # Test non-broadcast setitem:
+ b = arr.copy()
+diff --git a/numpy/_core/tests/test_item_selection.py b/numpy/_core/tests/test_item_selection.py
+index 5660ef583e..839127ecdb 100644
+--- a/numpy/_core/tests/test_item_selection.py
++++ b/numpy/_core/tests/test_item_selection.py
+@@ -50,19 +50,23 @@ def test_simple(self):
+
+ def test_refcounting(self):
+ objects = [object() for i in range(10)]
++ if HAS_REFCOUNT:
++ orig_rcs = [sys.getrefcount(o) for o in objects]
+ for mode in ('raise', 'clip', 'wrap'):
+ a = np.array(objects)
+ b = np.array([2, 2, 4, 5, 3, 5])
+ a.take(b, out=a[:6], mode=mode)
+ del a
+ if HAS_REFCOUNT:
+- assert_(all(sys.getrefcount(o) == 3 for o in objects))
++ assert_(all(sys.getrefcount(o) == rc + 1
++ for o, rc in zip(objects, orig_rcs)))
+ # not contiguous, example:
+ a = np.array(objects * 2)[::2]
+ a.take(b, out=a[:6], mode=mode)
+ del a
+ if HAS_REFCOUNT:
+- assert_(all(sys.getrefcount(o) == 3 for o in objects))
++ assert_(all(sys.getrefcount(o) == rc + 1
++ for o, rc in zip(objects, orig_rcs)))
+
+ def test_unicode_mode(self):
+ d = np.arange(10)
+diff --git a/numpy/_core/tests/test_multiarray.py b/numpy/_core/tests/test_multiarray.py
+index 87508732d8..3f26578c85 100644
+--- a/numpy/_core/tests/test_multiarray.py
++++ b/numpy/_core/tests/test_multiarray.py
+@@ -6779,10 +6779,12 @@ def test_dot_3args(self):
+ v = np.random.random_sample((16, 32))
+
+ r = np.empty((1024, 32))
++ if HAS_REFCOUNT:
++ orig_refcount = sys.getrefcount(r)
+ for i in range(12):
+ dot(f, v, r)
+ if HAS_REFCOUNT:
+- assert_equal(sys.getrefcount(r), 2)
++ assert_equal(sys.getrefcount(r), orig_refcount)
+ r2 = dot(f, v, out=None)
+ assert_array_equal(r2, r)
+ assert_(r is dot(f, v, out=r))
+diff --git a/numpy/_core/tests/test_nditer.py b/numpy/_core/tests/test_nditer.py
+index b0d911f24f..d6a9e42ae3 100644
+--- a/numpy/_core/tests/test_nditer.py
++++ b/numpy/_core/tests/test_nditer.py
+@@ -1126,9 +1126,10 @@ def test_iter_object_arrays_conversions():
+ rc = sys.getrefcount(ob)
+ for x in i:
+ x[...] += 1
+- if HAS_REFCOUNT:
+- assert_(sys.getrefcount(ob) == rc-1)
+- assert_equal(a, np.arange(6)+98172489)
++ if HAS_REFCOUNT:
++ newrc = sys.getrefcount(ob)
++ assert_(newrc == rc - 1)
++ assert_equal(a, np.arange(6) + 98172489)
+
+ def test_iter_common_dtype():
+ # Check that the iterator finds a common data type correctly
+diff --git a/numpy/_core/tests/test_regression.py b/numpy/_core/tests/test_regression.py
+index 851ce324d7..eeb640659e 100644
+--- a/numpy/_core/tests/test_regression.py
++++ b/numpy/_core/tests/test_regression.py
+@@ -1586,29 +1586,26 @@ def test_take_refcount(self):
+ def test_fromfile_tofile_seeks(self):
+ # On Python 3, tofile/fromfile used to get (#1610) the Python
+ # file handle out of sync
+- f0 = tempfile.NamedTemporaryFile()
+- f = f0.file
+- f.write(np.arange(255, dtype='u1').tobytes())
+-
+- f.seek(20)
+- ret = np.fromfile(f, count=4, dtype='u1')
+- assert_equal(ret, np.array([20, 21, 22, 23], dtype='u1'))
+- assert_equal(f.tell(), 24)
+-
+- f.seek(40)
+- np.array([1, 2, 3], dtype='u1').tofile(f)
+- assert_equal(f.tell(), 43)
+-
+- f.seek(40)
+- data = f.read(3)
+- assert_equal(data, b"\x01\x02\x03")
+-
+- f.seek(80)
+- f.read(4)
+- data = np.fromfile(f, dtype='u1', count=4)
+- assert_equal(data, np.array([84, 85, 86, 87], dtype='u1'))
+-
+- f.close()
++ with tempfile.NamedTemporaryFile() as f:
++ f.write(np.arange(255, dtype='u1').tobytes())
++
++ f.seek(20)
++ ret = np.fromfile(f, count=4, dtype='u1')
++ assert_equal(ret, np.array([20, 21, 22, 23], dtype='u1'))
++ assert_equal(f.tell(), 24)
++
++ f.seek(40)
++ np.array([1, 2, 3], dtype='u1').tofile(f)
++ assert_equal(f.tell(), 43)
++
++ f.seek(40)
++ data = f.read(3)
++ assert_equal(data, b"\x01\x02\x03")
++
++ f.seek(80)
++ f.read(4)
++ data = np.fromfile(f, dtype='u1', count=4)
++ assert_equal(data, np.array([84, 85, 86, 87], dtype='u1'))
+
+ def test_complex_scalar_warning(self):
+ for tp in [np.csingle, np.cdouble, np.clongdouble]:
+diff --git a/numpy/_core/tests/test_umath.py b/numpy/_core/tests/test_umath.py
+index 4d56c785d5..d432e33412 100644
+--- a/numpy/_core/tests/test_umath.py
++++ b/numpy/_core/tests/test_umath.py
+@@ -269,9 +269,9 @@ class ArrSubclass(np.ndarray):
+ pass
+
+ arr = np.arange(10).view(ArrSubclass)
+-
++ orig_refcount = sys.getrefcount(arr)
+ arr *= 1
+- assert sys.getrefcount(arr) == 2
++ assert sys.getrefcount(arr) == orig_refcount
+
+
+ class TestComparisons:
diff --git a/dev-python/numpy/files/numpy-2.2.6-gcc16.patch b/dev-python/numpy/files/numpy-2.2.6-gcc16.patch
new file mode 100644
index 000000000000..a297551ded05
--- /dev/null
+++ b/dev-python/numpy/files/numpy-2.2.6-gcc16.patch
@@ -0,0 +1,14 @@
+https://github.com/google/highway/issues/2577
+https://github.com/google/highway/commit/7cde540171a1718a9bdfa8f896d70e47eb0785d5
+--- a/numpy/_core/src/highway/hwy/ops/set_macros-inl.h
++++ b/numpy/_core/src/highway/hwy/ops/set_macros-inl.h
+@@ -141,7 +141,8 @@
+ #define HWY_TARGET_STR_AVX2 \
+ HWY_TARGET_STR_SSE4 ",avx,avx2" HWY_TARGET_STR_BMI2_FMA HWY_TARGET_STR_F16C
+
+-#if HWY_COMPILER_GCC_ACTUAL >= 1400 || HWY_COMPILER_CLANG >= 1800
++#if (HWY_COMPILER_GCC_ACTUAL >= 1400 && HWY_COMPILER_GCC_ACTUAL < 1600) || \
++ HWY_COMPILER_CLANG >= 1800
+ #define HWY_TARGET_STR_AVX3_VL512 ",evex512"
+ #else
+ #define HWY_TARGET_STR_AVX3_VL512
diff --git a/dev-python/numpy/metadata.xml b/dev-python/numpy/metadata.xml
new file mode 100644
index 000000000000..c6656a0c3fd8
--- /dev/null
+++ b/dev-python/numpy/metadata.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "https://docs.baldeagleos.com/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="project">
+ <email>sci@gentoo.org</email>
+ <name>Gentoo Science Project</name>
+ </maintainer>
+ <maintainer type="project">
+ <email>python@gentoo.org</email>
+ <name>Python</name>
+ </maintainer>
+ <longdescription lang="en">
+ NumPy is a general-purpose array-processing Python package designed to
+ efficiently manipulate large multi-dimensional arrays of arbitrary
+ records without sacrificing too much speed for small multi-dimensional
+ arrays. There are also basic facilities for discrete fourier transform,
+ basic linear algebra and random number generation.
+ It is the successor of Numeric and numarray.
+ </longdescription>
+ <upstream>
+ <remote-id type="cpe">cpe:/a:numpy:numpy</remote-id>
+ </upstream>
+ <use>
+ <flag name="cpudetection">
+ Enable dynamic dispatch to additional CPU extensions not covered
+ by enabled CPU_FLAGS_*. This permits NumPy to benefit from improved
+ performance when CPUs support more instruction sets, while preserving
+ compatibility with the baseline set by CPU_FLAGS_*.
+ </flag>
+ </use>
+ <origin>baldeagleos-repo</origin>
+</pkgmetadata>
diff --git a/dev-python/numpy/numpy-2.2.6.ebuild b/dev-python/numpy/numpy-2.2.6.ebuild
new file mode 100644
index 000000000000..ab989c443b99
--- /dev/null
+++ b/dev-python/numpy/numpy-2.2.6.ebuild
@@ -0,0 +1,205 @@
+# Copyright 1999-2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+DISTUTILS_EXT=1
+DISTUTILS_USE_PEP517=meson-python
+PYTHON_COMPAT=( python3_{13..14} )
+PYTHON_REQ_USE="threads(+)"
+FORTRAN_NEEDED=lapack
+
+inherit distutils-r1 flag-o-matic fortran-2 pypi
+
+DESCRIPTION="Fast array and numerical python library"
+HOMEPAGE="
+ https://numpy.org/
+ https://github.com/numpy/numpy/
+ https://pypi.org/project/numpy/
+"
+
+LICENSE="BSD"
+SLOT="0/2"
+KEYWORDS="~alpha amd64 arm arm64 ~hppa ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc x86"
+# +lapack because the internal fallbacks are pretty slow. Building without blas
+# is barely supported anyway, see bug #914358.
+IUSE="big-endian +lapack"
+
+RDEPEND="
+ lapack? (
+ >=virtual/cblas-3.8
+ >=virtual/lapack-3.8
+ )
+"
+BDEPEND="
+ ${RDEPEND}
+ >=dev-build/meson-1.1.0
+ >=dev-python/cython-3.0.6[${PYTHON_USEDEP}]
+ lapack? (
+ virtual/pkgconfig
+ )
+ test? (
+ $(python_gen_cond_dep '
+ >=dev-python/cffi-1.14.0[${PYTHON_USEDEP}]
+ ' 'python*')
+ dev-python/charset-normalizer[${PYTHON_USEDEP}]
+ >=dev-python/hypothesis-5.8.0[${PYTHON_USEDEP}]
+ dev-python/pytest-rerunfailures[${PYTHON_USEDEP}]
+ dev-python/pytest-timeout[${PYTHON_USEDEP}]
+ >=dev-python/pytz-2019.3[${PYTHON_USEDEP}]
+ )
+"
+
+QA_CONFIG_IMPL_DECL_SKIP=(
+ # https://bugs.gentoo.org/925367
+ vrndq_f32
+)
+
+EPYTEST_XDIST=1
+distutils_enable_tests pytest
+
+python_prepare_all() {
+ local PATCHES=(
+ # https://github.com/numpy/numpy/pull/28748
+ # https://github.com/numpy/numpy/pull/28928
+ "${FILESDIR}/${PN}-2.2.5-py314.patch"
+ # https://github.com/google/highway/issues/2577
+ # github.com/google/highway/commit/7cde540171a1718a9bdfa8f896d70e47eb0785d5
+ "${FILESDIR}/${PN}-2.2.6-gcc16.patch"
+ )
+
+ # bug #922457
+ filter-lto
+ # https://github.com/numpy/numpy/issues/25004
+ append-flags -fno-strict-aliasing
+
+ distutils-r1_python_prepare_all
+}
+
+python_configure_all() {
+ DISTUTILS_ARGS=(
+ -Dallow-noblas=$(usex !lapack true false)
+ -Dblas=$(usev lapack cblas)
+ -Dlapack=$(usev lapack lapack)
+ # TODO: cpu-* options
+ )
+}
+
+python_test() {
+ local EPYTEST_DESELECT=(
+ # Very disk-and-memory-hungry
+ numpy/lib/tests/test_io.py::TestSaveTxt::test_large_zip
+ numpy/lib/tests/test_io.py::TestSavezLoad::test_closing_fid
+ numpy/lib/tests/test_io.py::TestSavezLoad::test_closing_zipfile_after_load
+
+ # Precision problems
+ numpy/_core/tests/test_umath_accuracy.py::TestAccuracy::test_validate_transcendentals
+
+ # Runs the whole test suite recursively, that's just crazy
+ numpy/core/tests/test_mem_policy.py::test_new_policy
+
+ numpy/typing/tests/test_typing.py
+ # Uses huge amount of memory
+ numpy/core/tests/test_mem_overlap.py
+ )
+
+ if [[ $(uname -m) == armv8l ]]; then
+ # Degenerate case of arm32 chroot on arm64, bug #774108
+ EPYTEST_DESELECT+=(
+ numpy/_core/tests/test_cpu_features.py::Test_ARM_Features::test_features
+ )
+ fi
+
+ case ${ARCH} in
+ arm)
+ EPYTEST_DESELECT+=(
+ # TODO: warnings
+ numpy/_core/tests/test_umath.py::TestSpecialFloats::test_unary_spurious_fpexception
+
+ # TODO
+ numpy/_core/tests/test_function_base.py::TestLinspace::test_denormal_numbers
+ numpy/f2py/tests/test_kind.py::TestKind::test_real
+ numpy/f2py/tests/test_kind.py::TestKind::test_quad_precision
+
+ # require too much memory
+ 'numpy/_core/tests/test_multiarray.py::TestDot::test_huge_vectordot[complex128]'
+ 'numpy/_core/tests/test_multiarray.py::TestDot::test_huge_vectordot[float64]'
+ )
+ ;;
+ hppa)
+ EPYTEST_DESELECT+=(
+ # https://bugs.gentoo.org/942689
+ "numpy/_core/tests/test_dtype.py::TestBuiltin::test_dtype[int]"
+ "numpy/_core/tests/test_dtype.py::TestBuiltin::test_dtype[float]"
+ "numpy/_core/tests/test_dtype.py::TestBuiltin::test_dtype_bytes_str_equivalence[datetime64]"
+ "numpy/_core/tests/test_dtype.py::TestBuiltin::test_dtype_bytes_str_equivalence[timedelta64]"
+ "numpy/_core/tests/test_dtype.py::TestBuiltin::test_dtype_bytes_str_equivalence[<f]"
+ "numpy/_core/tests/test_dtype.py::TestPickling::test_pickle_dtype[dt28]"
+ numpy/f2py/tests/test_kind.py::TestKind::test_real
+ numpy/f2py/tests/test_kind.py::TestKind::test_quad_precision
+ numpy/tests/test_ctypeslib.py::TestAsArray::test_reference_cycles
+ numpy/tests/test_ctypeslib.py::TestAsArray::test_segmentation_fault
+ numpy/tests/test_ctypeslib.py::TestAsCtypesType::test_scalar
+ numpy/tests/test_ctypeslib.py::TestAsCtypesType::test_subarray
+ numpy/tests/test_ctypeslib.py::TestAsCtypesType::test_structure
+ numpy/tests/test_ctypeslib.py::TestAsCtypesType::test_structure_aligned
+ numpy/tests/test_ctypeslib.py::TestAsCtypesType::test_union
+ numpy/tests/test_ctypeslib.py::TestAsCtypesType::test_padded_union
+ )
+ ;;
+ ppc|x86)
+ EPYTEST_DESELECT+=(
+ # require too much memory
+ 'numpy/_core/tests/test_multiarray.py::TestDot::test_huge_vectordot[complex128]'
+ 'numpy/_core/tests/test_multiarray.py::TestDot::test_huge_vectordot[float64]'
+ )
+ ;;
+ esac
+
+ if [[ ${CHOST} == powerpc64le-* ]]; then
+ EPYTEST_DESELECT+=(
+ # long double thingy
+ numpy/_core/tests/test_scalarprint.py::TestRealScalars::test_ppc64_ibm_double_double128
+ )
+ fi
+
+ if use big-endian; then
+ EPYTEST_DESELECT+=(
+ # ppc64 and sparc
+ numpy/linalg/tests/test_linalg.py::TestDet::test_generalized_sq_cases
+ numpy/linalg/tests/test_linalg.py::TestDet::test_sq_cases
+ "numpy/f2py/tests/test_return_character.py::TestFReturnCharacter::test_all_f77[s1]"
+ "numpy/f2py/tests/test_return_character.py::TestFReturnCharacter::test_all_f77[t1]"
+ "numpy/f2py/tests/test_return_character.py::TestFReturnCharacter::test_all_f90[s1]"
+ "numpy/f2py/tests/test_return_character.py::TestFReturnCharacter::test_all_f90[t1]"
+ )
+ fi
+
+ if ! has_version -b "~${CATEGORY}/${P}[${PYTHON_USEDEP}]" ; then
+ # depends on importing numpy.random from system namespace
+ EPYTEST_DESELECT+=(
+ 'numpy/random/tests/test_extending.py::test_cython'
+ )
+ fi
+
+ if has_version ">=dev-python/setuptools-74[${PYTHON_USEDEP}]"; then
+ # msvccompiler removal
+ EPYTEST_DESELECT+=(
+ numpy/tests/test_public_api.py::test_all_modules_are_expected_2
+ numpy/tests/test_public_api.py::test_api_importable
+ )
+ EPYTEST_IGNORE+=(
+ numpy/distutils/tests/test_mingw32ccompiler.py
+ numpy/distutils/tests/test_system_info.py
+ )
+ fi
+
+ local -x PYTEST_DISABLE_PLUGIN_AUTOLOAD=1
+ cd "${BUILD_DIR}/install$(python_get_sitedir)" || die
+ epytest -p rerunfailures --reruns=5
+}
+
+python_install_all() {
+ local DOCS=( LICENSE.txt README.md THANKS.txt )
+ distutils-r1_python_install_all
+}
diff --git a/dev-python/numpy/numpy-2.4.4.ebuild b/dev-python/numpy/numpy-2.4.4.ebuild
new file mode 100644
index 000000000000..8a7ff00a4e7c
--- /dev/null
+++ b/dev-python/numpy/numpy-2.4.4.ebuild
@@ -0,0 +1,315 @@
+# Copyright 1999-2026 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+DISTUTILS_EXT=1
+DISTUTILS_USE_PEP517=meson-python
+PYPI_VERIFY_REPO=https://github.com/numpy/numpy-release
+PYTHON_COMPAT=( python3_{13..14} )
+PYTHON_REQ_USE="threads(+)"
+FORTRAN_NEEDED=lapack
+
+inherit distutils-r1 flag-o-matic fortran-2 pypi
+
+DESCRIPTION="Fast array and numerical python library"
+HOMEPAGE="
+ https://numpy.org/
+ https://github.com/numpy/numpy/
+ https://pypi.org/project/numpy/
+"
+
+LICENSE="BSD 0BSD MIT ZLIB CC0-1.0"
+SLOT="0/2"
+if [[ ${PV} != *_rc* ]]; then
+ KEYWORDS="~alpha amd64 arm arm64 ~hppa ~loong ~m68k ~mips ~ppc ppc64 ~riscv ~s390 ~sparc x86"
+fi
+# +lapack because the internal fallbacks are pretty slow. Building without blas
+# is barely supported anyway, see bug #914358.
+IUSE="big-endian +cpudetection index64 +lapack"
+
+# upstream-flag[:gentoo-flag]
+ARM_FLAGS=( neon{,-fp16} vfpv4 asimd{,hp,dp,fhm} sve )
+PPC_FLAGS=( vsx vsx2 vsx3 vsx4 )
+X86_FLAGS=(
+ avx2 avx512{bw,dq,vl} avx512_{bf16,bitalg,fp16,vbmi2} sse4_2
+)
+IUSE+="
+ ${ARM_FLAGS[*]/#/cpu_flags_arm_}
+ ${PPC_FLAGS[*]/#/cpu_flags_ppc_}
+ ${X86_FLAGS[*]/#/cpu_flags_x86_}
+"
+
+RDEPEND="
+ lapack? (
+ >=virtual/cblas-3.8[index64(-)?]
+ >=virtual/lapack-3.8[index64(-)?]
+ )
+"
+BDEPEND="
+ ${RDEPEND}
+ >=dev-build/meson-1.5.2
+ >=dev-python/cython-3.0.6[${PYTHON_USEDEP}]
+ lapack? (
+ virtual/pkgconfig
+ )
+ test? (
+ $(python_gen_cond_dep '
+ >=dev-python/cffi-1.14.0[${PYTHON_USEDEP}]
+ ' 'python*')
+ dev-python/charset-normalizer[${PYTHON_USEDEP}]
+ >=dev-python/pytz-2019.3[${PYTHON_USEDEP}]
+ )
+"
+
+QA_CONFIG_IMPL_DECL_SKIP=(
+ # https://bugs.gentoo.org/925367
+ vrndq_f32
+)
+
+EPYTEST_PLUGINS=( hypothesis pytest-timeout )
+EPYTEST_XDIST=1
+distutils_enable_tests pytest
+
+has_all_x86() {
+ local flag
+ for flag; do
+ if ! use "cpu_flags_x86_${flag}"; then
+ return 1
+ fi
+ done
+ return 0
+}
+
+python_configure_all() {
+ local cpu_baseline=()
+ local map flag
+ case ${ARCH} in
+ arm)
+ # every flag implies the previous one
+ for map in NEON:neon NEON_FP16:neon-fp16 NEON_VFPV4:vfpv4; do
+ if ! use "cpu_flags_arm_${map#*:}"; then
+ break
+ fi
+ cpu_baseline+=( "${map%:*}" )
+ done
+ ;&
+ arm64)
+ # on 32-bit ARM, ASIMD implies all NEON* flags
+ # on 64-bit ARM, they are all linked together
+ if use arm64 ||
+ [[ ${cpu_baseline[@]} && ${cpu_baseline[-1]} == NEON_VFPV4 ]]
+ then
+ cpu_baseline+=( $(usev cpu_flags_arm_asimd ASIMD) )
+ fi
+
+ # these two imply ASIMD
+ if [[ ${cpu_baseline[@]} && ${cpu_baseline[-1]} == ASIMD ]]; then
+ for flag in dp hp; do
+ cpu_baseline+=(
+ $(usev "cpu_flags_arm_asimd${flag}" "ASIMD${flag^^}")
+ )
+ done
+ fi
+
+ # these two imply ASIMDHP
+ if [[ ${cpu_baseline[@]} && ${cpu_baseline[-1]} == ASIMDHP ]]; then
+ for flag in asimdfhm sve; do
+ cpu_baseline+=(
+ $(usev "cpu_flags_arm_${flag}" "${flag^^}")
+ )
+ done
+ fi
+ ;;
+ ppc64)
+ # every flag implies the previous one
+ for flag in '' 2 3 4; do
+ if ! use "cpu_flags_ppc_vsx${flags}"; then
+ break
+ fi
+ cpu_baseline+=( "VSX${flag}" )
+ done
+ ;;
+ amd64|x86)
+ # upstream combines multiple instructions into sets
+ local mapping=(
+ # for these, we just check the newest instruction set,
+ # since all earlier instruction sets imply it
+ "X86_V2=sse4_2"
+ "X86_V3=avx2"
+ # from here on, we check all features that were added
+ # in the lowest CPU supporting them all
+ # https://en.wikipedia.org/wiki/AVX-512
+ "X86_V4=avx512bw avx512dq avx512vl"
+ "AVX512_ICL=avx512_vbmi2 avx512_bitalg"
+ "AVX512_SPR=avx512_bf16 avx512_fp16"
+ )
+
+ local m
+ for m in "${mapping[@]}"; do
+ local feature=${m%=*}
+ local sets=${m#*=}
+
+ if has_all_x86 ${sets}; then
+ einfo "${feature} enabled: all of ${sets} enabled"
+ cpu_baseline+=( "${feature}" )
+ else
+ einfo "${feature} disabled: not all of ${sets} enabled"
+ break
+ fi
+ done
+ ;;
+ *)
+ cpu_baseline=MIN
+ ;;
+ esac
+
+ DISTUTILS_ARGS=(
+ -Dallow-noblas=$(usex !lapack true false)
+ -Duse-ilp64=$(usex index64 true false)
+ -Dblas=$(usev lapack $(usex index64 cblas64 cblas))
+ -Dlapack=$(usev lapack $(usex index64 lapack64 lapack))
+ -Dcpu-baseline="${cpu_baseline[*]}"
+ -Dcpu-baseline-detect=disabled
+ -Dcpu-dispatch="$(usev cpudetection MAX)"
+ )
+
+ # bug #922457
+ filter-lto
+ # https://github.com/numpy/numpy/issues/25004
+ append-flags -fno-strict-aliasing
+}
+
+python_test() {
+ # We run tests in parallel, so avoid having n^2 threads in lapack
+ # tests.
+ local -x BLIS_NUM_THREADS=1
+ local -x MKL_NUM_THREADS=1
+ local -x OMP_NUM_THREADS=1
+ local -x OPENBLAS_NUM_THREADS=1
+
+ # don't run tests that require more than 2 GiB of RAM (per process)
+ local -x NPY_AVAILABLE_MEM="2 GiB"
+
+ local EPYTEST_DESELECT=(
+ # Very disk-and-memory-hungry
+ numpy/lib/tests/test_io.py::TestSavezLoad::test_closing_fid
+ numpy/lib/tests/test_io.py::TestSavezLoad::test_closing_zipfile_after_load
+
+ # Precision problems
+ numpy/_core/tests/test_umath_accuracy.py::TestAccuracy::test_validate_transcendentals
+
+ numpy/typing/tests/test_typing.py
+
+ # Flaky, reruns don't help
+ numpy/f2py/tests/test_crackfortran.py
+ numpy/f2py/tests/test_data.py::TestData{,F77}::test_crackedlines
+ numpy/f2py/tests/test_f2py2e.py::test_gen_pyf
+ numpy/f2py/tests/test_f2py2e.py::test_gh22819_cli
+
+ # Broken by new setuptools
+ numpy/distutils/tests/test_fcompiler.py
+ numpy/distutils/tests/test_fcompiler_gnu.py
+ numpy/distutils/tests/test_fcompiler_intel.py
+ numpy/distutils/tests/test_fcompiler_nagfor.py
+ )
+
+ if [[ $(uname -m) == armv8l ]]; then
+ # Degenerate case of arm32 chroot on arm64, bug #774108
+ EPYTEST_DESELECT+=(
+ numpy/_core/tests/test_cpu_features.py::Test_ARM_Features::test_features
+ )
+ fi
+
+ case ${ARCH} in
+ arm)
+ EPYTEST_DESELECT+=(
+ # TODO: warnings
+ numpy/_core/tests/test_umath.py::TestSpecialFloats::test_unary_spurious_fpexception
+
+ # TODO
+ numpy/_core/tests/test_function_base.py::TestLinspace::test_denormal_numbers
+ numpy/f2py/tests/test_kind.py::TestKind::test_real
+ numpy/f2py/tests/test_kind.py::TestKind::test_quad_precision
+
+ # require too much memory
+ 'numpy/_core/tests/test_multiarray.py::TestDot::test_huge_vectordot[complex128]'
+ 'numpy/_core/tests/test_multiarray.py::TestDot::test_huge_vectordot[float64]'
+ )
+ ;;
+ hppa)
+ EPYTEST_DESELECT+=(
+ # https://bugs.gentoo.org/942689
+ "numpy/_core/tests/test_dtype.py::TestBuiltin::test_dtype[int]"
+ "numpy/_core/tests/test_dtype.py::TestBuiltin::test_dtype[float]"
+ "numpy/_core/tests/test_dtype.py::TestBuiltin::test_dtype_bytes_str_equivalence[datetime64]"
+ "numpy/_core/tests/test_dtype.py::TestBuiltin::test_dtype_bytes_str_equivalence[timedelta64]"
+ "numpy/_core/tests/test_dtype.py::TestBuiltin::test_dtype_bytes_str_equivalence[<f]"
+ "numpy/_core/tests/test_dtype.py::TestPickling::test_pickle_dtype[dt28]"
+ numpy/f2py/tests/test_kind.py::TestKind::test_real
+ numpy/f2py/tests/test_kind.py::TestKind::test_quad_precision
+ numpy/tests/test_ctypeslib.py::TestAsArray::test_reference_cycles
+ numpy/tests/test_ctypeslib.py::TestAsArray::test_segmentation_fault
+ numpy/tests/test_ctypeslib.py::TestAsCtypesType::test_scalar
+ numpy/tests/test_ctypeslib.py::TestAsCtypesType::test_subarray
+ numpy/tests/test_ctypeslib.py::TestAsCtypesType::test_structure
+ numpy/tests/test_ctypeslib.py::TestAsCtypesType::test_structure_aligned
+ numpy/tests/test_ctypeslib.py::TestAsCtypesType::test_union
+ numpy/tests/test_ctypeslib.py::TestAsCtypesType::test_padded_union
+ )
+ ;;
+ ppc|x86)
+ EPYTEST_DESELECT+=(
+ # require too much memory
+ 'numpy/_core/tests/test_multiarray.py::TestDot::test_huge_vectordot[complex128]'
+ 'numpy/_core/tests/test_multiarray.py::TestDot::test_huge_vectordot[float64]'
+ )
+ ;;
+ esac
+
+ if [[ ${CHOST} == powerpc64le-* ]]; then
+ EPYTEST_DESELECT+=(
+ # long double thingy
+ numpy/_core/tests/test_scalarprint.py::TestRealScalars::test_ppc64_ibm_double_double128
+ )
+ fi
+
+ if use big-endian; then
+ EPYTEST_DESELECT+=(
+ # ppc64 and sparc
+ numpy/linalg/tests/test_linalg.py::TestDet::test_generalized_sq_cases
+ numpy/linalg/tests/test_linalg.py::TestDet::test_sq_cases
+ "numpy/f2py/tests/test_return_character.py::TestFReturnCharacter::test_all_f77[s1]"
+ "numpy/f2py/tests/test_return_character.py::TestFReturnCharacter::test_all_f77[t1]"
+ "numpy/f2py/tests/test_return_character.py::TestFReturnCharacter::test_all_f90[s1]"
+ "numpy/f2py/tests/test_return_character.py::TestFReturnCharacter::test_all_f90[t1]"
+ )
+ fi
+
+ if ! has_version -b "~${CATEGORY}/${P}[${PYTHON_USEDEP}]" ; then
+ # depends on importing numpy.random from system namespace
+ EPYTEST_DESELECT+=(
+ 'numpy/random/tests/test_extending.py::test_cython'
+ )
+ fi
+
+ if has_version ">=dev-python/setuptools-74[${PYTHON_USEDEP}]"; then
+ # msvccompiler removal
+ EPYTEST_DESELECT+=(
+ numpy/tests/test_public_api.py::test_all_modules_are_expected_2
+ numpy/tests/test_public_api.py::test_api_importable
+ )
+ EPYTEST_IGNORE+=(
+ numpy/distutils/tests/test_mingw32ccompiler.py
+ numpy/distutils/tests/test_system_info.py
+ )
+ fi
+
+ cd "${BUILD_DIR}/install$(python_get_sitedir)" || die
+ epytest
+}
+
+python_install_all() {
+ local DOCS=( LICENSE.txt README.md THANKS.txt )
+ distutils-r1_python_install_all
+}
diff --git a/dev-python/numpy/numpy-2.4.5.ebuild b/dev-python/numpy/numpy-2.4.5.ebuild
new file mode 100644
index 000000000000..dda0acf87827
--- /dev/null
+++ b/dev-python/numpy/numpy-2.4.5.ebuild
@@ -0,0 +1,329 @@
+# Copyright 1999-2026 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+DISTUTILS_EXT=1
+DISTUTILS_USE_PEP517=meson-python
+PYPI_VERIFY_REPO=https://github.com/numpy/numpy-release
+PYTHON_COMPAT=( python3_{13..14} )
+PYTHON_REQ_USE="threads(+)"
+FORTRAN_NEEDED=lapack
+
+inherit distutils-r1 flag-o-matic fortran-2 pypi
+
+DESCRIPTION="Fast array and numerical python library"
+HOMEPAGE="
+ https://numpy.org/
+ https://github.com/numpy/numpy/
+ https://pypi.org/project/numpy/
+"
+
+LICENSE="BSD 0BSD MIT ZLIB CC0-1.0"
+SLOT="0/2"
+if [[ ${PV} != *_rc* ]]; then
+ KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+fi
+# +lapack because the internal fallbacks are pretty slow. Building without blas
+# is barely supported anyway, see bug #914358.
+IUSE="big-endian +cpudetection index64 +lapack"
+
+# upstream-flag[:gentoo-flag]
+ARM_FLAGS=( neon{,-fp16} vfpv4 asimd{,hp,dp,fhm} sve )
+PPC_FLAGS=( vsx vsx2 vsx3 vsx4 )
+X86_FLAGS=(
+ avx2 avx512{bw,dq,vl} avx512_{bf16,bitalg,fp16,vbmi2} sse4_2
+)
+IUSE+="
+ ${ARM_FLAGS[*]/#/cpu_flags_arm_}
+ ${PPC_FLAGS[*]/#/cpu_flags_ppc_}
+ ${X86_FLAGS[*]/#/cpu_flags_x86_}
+"
+
+RDEPEND="
+ lapack? (
+ >=virtual/cblas-3.8[index64(-)?]
+ >=virtual/lapack-3.8[index64(-)?]
+ )
+"
+BDEPEND="
+ ${RDEPEND}
+ >=dev-build/meson-1.5.2
+ >=dev-python/cython-3.0.6[${PYTHON_USEDEP}]
+ lapack? (
+ virtual/pkgconfig
+ )
+ test? (
+ $(python_gen_cond_dep '
+ >=dev-python/cffi-1.14.0[${PYTHON_USEDEP}]
+ ' 'python*')
+ dev-python/charset-normalizer[${PYTHON_USEDEP}]
+ >=dev-python/pytz-2019.3[${PYTHON_USEDEP}]
+ )
+"
+
+QA_CONFIG_IMPL_DECL_SKIP=(
+ # https://bugs.gentoo.org/925367
+ vrndq_f32
+)
+
+EPYTEST_PLUGINS=( hypothesis pytest-timeout )
+EPYTEST_XDIST=1
+distutils_enable_tests pytest
+
+has_all_x86() {
+ local flag
+ for flag; do
+ if ! use "cpu_flags_x86_${flag}"; then
+ return 1
+ fi
+ done
+ return 0
+}
+
+python_configure_all() {
+ local cpu_baseline=()
+ local map flag
+ case ${ARCH} in
+ arm)
+ # every flag implies the previous one
+ for map in NEON:neon NEON_FP16:neon-fp16 NEON_VFPV4:vfpv4; do
+ if ! use "cpu_flags_arm_${map#*:}"; then
+ break
+ fi
+ cpu_baseline+=( "${map%:*}" )
+ done
+ ;&
+ arm64)
+ # on 32-bit ARM, ASIMD implies all NEON* flags
+ # on 64-bit ARM, they are all linked together
+ if use arm64 ||
+ [[ ${cpu_baseline[@]} && ${cpu_baseline[-1]} == NEON_VFPV4 ]]
+ then
+ cpu_baseline+=( $(usev cpu_flags_arm_asimd ASIMD) )
+ fi
+
+ # these two imply ASIMD
+ if [[ ${cpu_baseline[@]} && ${cpu_baseline[-1]} == ASIMD ]]; then
+ for flag in dp hp; do
+ cpu_baseline+=(
+ $(usev "cpu_flags_arm_asimd${flag}" "ASIMD${flag^^}")
+ )
+ done
+ fi
+
+ # these two imply ASIMDHP
+ if [[ ${cpu_baseline[@]} && ${cpu_baseline[-1]} == ASIMDHP ]]; then
+ for flag in asimdfhm sve; do
+ cpu_baseline+=(
+ $(usev "cpu_flags_arm_${flag}" "${flag^^}")
+ )
+ done
+ fi
+ ;;
+ ppc64)
+ # every flag implies the previous one
+ for flag in '' 2 3 4; do
+ if ! use "cpu_flags_ppc_vsx${flags}"; then
+ break
+ fi
+ cpu_baseline+=( "VSX${flag}" )
+ done
+ ;;
+ amd64|x86)
+ # upstream combines multiple instructions into sets
+ local mapping=(
+ # for these, we just check the newest instruction set,
+ # since all earlier instruction sets imply it
+ "X86_V2=sse4_2"
+ "X86_V3=avx2"
+ # from here on, we check all features that were added
+ # in the lowest CPU supporting them all
+ # https://en.wikipedia.org/wiki/AVX-512
+ "X86_V4=avx512bw avx512dq avx512vl"
+ "AVX512_ICL=avx512_vbmi2 avx512_bitalg"
+ "AVX512_SPR=avx512_bf16 avx512_fp16"
+ )
+
+ local m
+ for m in "${mapping[@]}"; do
+ local feature=${m%=*}
+ local sets=${m#*=}
+
+ if has_all_x86 ${sets}; then
+ einfo "${feature} enabled: all of ${sets} enabled"
+ cpu_baseline+=( "${feature}" )
+ else
+ einfo "${feature} disabled: not all of ${sets} enabled"
+ break
+ fi
+ done
+ ;;
+ *)
+ cpu_baseline=MIN
+ ;;
+ esac
+
+ DISTUTILS_ARGS=(
+ -Dallow-noblas=$(usex !lapack true false)
+ -Duse-ilp64=$(usex index64 true false)
+ -Dblas=$(usev lapack $(usex index64 cblas64 cblas))
+ -Dlapack=$(usev lapack $(usex index64 lapack64 lapack))
+ -Dcpu-baseline="${cpu_baseline[*]}"
+ -Dcpu-baseline-detect=disabled
+ -Dcpu-dispatch="$(usev cpudetection MAX)"
+ )
+
+ # bug #922457
+ filter-lto
+ # https://github.com/numpy/numpy/issues/25004
+ append-flags -fno-strict-aliasing
+}
+
+python_test() {
+ # We run tests in parallel, so avoid having n^2 threads in lapack
+ # tests.
+ local -x BLIS_NUM_THREADS=1
+ local -x MKL_NUM_THREADS=1
+ local -x OMP_NUM_THREADS=1
+ local -x OPENBLAS_NUM_THREADS=1
+
+ # don't run tests that require more than 2 GiB of RAM (per process)
+ local -x NPY_AVAILABLE_MEM="2 GiB"
+
+ local EPYTEST_DESELECT=(
+ # Very disk-and-memory-hungry
+ numpy/lib/tests/test_io.py::TestSavezLoad::test_closing_fid
+ numpy/lib/tests/test_io.py::TestSavezLoad::test_closing_zipfile_after_load
+
+ # Precision problems
+ numpy/_core/tests/test_umath_accuracy.py::TestAccuracy::test_validate_transcendentals
+
+ numpy/typing/tests/test_typing.py
+
+ # Flaky, reruns don't help
+ numpy/f2py/tests/test_crackfortran.py
+ numpy/f2py/tests/test_data.py::TestData{,F77}::test_crackedlines
+ numpy/f2py/tests/test_f2py2e.py::test_gen_pyf
+ numpy/f2py/tests/test_f2py2e.py::test_gh22819_cli
+
+ # Broken by new setuptools
+ numpy/distutils/tests/test_fcompiler.py
+ numpy/distutils/tests/test_fcompiler_gnu.py
+ numpy/distutils/tests/test_fcompiler_intel.py
+ numpy/distutils/tests/test_fcompiler_nagfor.py
+ )
+
+ if [[ $(uname -m) == armv8l ]]; then
+ # Degenerate case of arm32 chroot on arm64, bug #774108
+ EPYTEST_DESELECT+=(
+ numpy/_core/tests/test_cpu_features.py::Test_ARM_Features::test_features
+ )
+ fi
+
+ case ${ARCH} in
+ arm)
+ EPYTEST_DESELECT+=(
+ # TODO: warnings
+ numpy/_core/tests/test_umath.py::TestSpecialFloats::test_unary_spurious_fpexception
+
+ # TODO
+ numpy/_core/tests/test_function_base.py::TestLinspace::test_denormal_numbers
+ numpy/f2py/tests/test_kind.py::TestKind::test_real
+ numpy/f2py/tests/test_kind.py::TestKind::test_quad_precision
+
+ # require too much memory
+ 'numpy/_core/tests/test_multiarray.py::TestDot::test_huge_vectordot[complex128]'
+ 'numpy/_core/tests/test_multiarray.py::TestDot::test_huge_vectordot[float64]'
+ )
+ ;;
+ hppa)
+ EPYTEST_DESELECT+=(
+ # https://bugs.gentoo.org/942689
+ "numpy/_core/tests/test_dtype.py::TestBuiltin::test_dtype[int]"
+ "numpy/_core/tests/test_dtype.py::TestBuiltin::test_dtype[float]"
+ "numpy/_core/tests/test_dtype.py::TestBuiltin::test_dtype_bytes_str_equivalence[datetime64]"
+ "numpy/_core/tests/test_dtype.py::TestBuiltin::test_dtype_bytes_str_equivalence[timedelta64]"
+ "numpy/_core/tests/test_dtype.py::TestBuiltin::test_dtype_bytes_str_equivalence[<f]"
+ "numpy/_core/tests/test_dtype.py::TestPickling::test_pickle_dtype[dt28]"
+ numpy/f2py/tests/test_kind.py::TestKind::test_real
+ numpy/f2py/tests/test_kind.py::TestKind::test_quad_precision
+ numpy/tests/test_ctypeslib.py::TestAsArray::test_reference_cycles
+ numpy/tests/test_ctypeslib.py::TestAsArray::test_segmentation_fault
+ numpy/tests/test_ctypeslib.py::TestAsCtypesType::test_scalar
+ numpy/tests/test_ctypeslib.py::TestAsCtypesType::test_subarray
+ numpy/tests/test_ctypeslib.py::TestAsCtypesType::test_structure
+ numpy/tests/test_ctypeslib.py::TestAsCtypesType::test_structure_aligned
+ numpy/tests/test_ctypeslib.py::TestAsCtypesType::test_union
+ numpy/tests/test_ctypeslib.py::TestAsCtypesType::test_padded_union
+ )
+ ;;
+ ppc|x86)
+ EPYTEST_DESELECT+=(
+ # require too much memory
+ 'numpy/_core/tests/test_multiarray.py::TestDot::test_huge_vectordot[complex128]'
+ 'numpy/_core/tests/test_multiarray.py::TestDot::test_huge_vectordot[float64]'
+ )
+ ;;
+ esac
+
+ if [[ ${CHOST} == powerpc64le-* ]]; then
+ EPYTEST_DESELECT+=(
+ # long double thingy
+ numpy/_core/tests/test_scalarprint.py::TestRealScalars::test_ppc64_ibm_double_double128
+ )
+ fi
+
+ if use big-endian; then
+ EPYTEST_DESELECT+=(
+ # ppc64 and sparc
+ numpy/linalg/tests/test_linalg.py::TestDet::test_generalized_sq_cases
+ numpy/linalg/tests/test_linalg.py::TestDet::test_sq_cases
+ "numpy/f2py/tests/test_return_character.py::TestFReturnCharacter::test_all_f77[s1]"
+ "numpy/f2py/tests/test_return_character.py::TestFReturnCharacter::test_all_f77[t1]"
+ "numpy/f2py/tests/test_return_character.py::TestFReturnCharacter::test_all_f90[s1]"
+ "numpy/f2py/tests/test_return_character.py::TestFReturnCharacter::test_all_f90[t1]"
+ )
+ fi
+
+ if ! has_version -b "~${CATEGORY}/${P}[${PYTHON_USEDEP}]" ; then
+ # depends on importing numpy.random from system namespace
+ EPYTEST_DESELECT+=(
+ 'numpy/random/tests/test_extending.py::test_cython'
+ )
+ fi
+
+ if has_version ">=dev-python/setuptools-74[${PYTHON_USEDEP}]"; then
+ # msvccompiler removal
+ EPYTEST_DESELECT+=(
+ numpy/tests/test_public_api.py::test_all_modules_are_expected_2
+ numpy/tests/test_public_api.py::test_api_importable
+ )
+ EPYTEST_IGNORE+=(
+ numpy/distutils/tests/test_mingw32ccompiler.py
+ numpy/distutils/tests/test_system_info.py
+ )
+ fi
+
+ case ${EPYTHON} in
+ pypy3.11)
+ EPYTEST_DESELECT+=(
+ numpy/_core/tests/test_regression.py::TestRegression::test_buffer_hashlib
+ numpy/random/tests/test_generator_mt19937.py::TestIntegers::test_repeatability
+ numpy/random/tests/test_generator_mt19937.py::TestRandomDist::test_choice_large_sample
+ numpy/random/tests/test_generator_mt19937.py::test_jumped
+ numpy/random/tests/test_random.py::TestRandint::test_repeatability
+ numpy/random/tests/test_randomstate.py::TestRandint::test_repeatability
+ numpy/random/tests/test_randomstate.py::test_integer_repeat
+ )
+ ;;
+ esac
+
+ cd "${BUILD_DIR}/install$(python_get_sitedir)" || die
+ epytest
+}
+
+python_install_all() {
+ local DOCS=( LICENSE.txt README.md THANKS.txt )
+ distutils-r1_python_install_all
+}
diff --git a/dev-python/numpy/numpy-2.4.6.ebuild b/dev-python/numpy/numpy-2.4.6.ebuild
new file mode 100644
index 000000000000..dda0acf87827
--- /dev/null
+++ b/dev-python/numpy/numpy-2.4.6.ebuild
@@ -0,0 +1,329 @@
+# Copyright 1999-2026 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+DISTUTILS_EXT=1
+DISTUTILS_USE_PEP517=meson-python
+PYPI_VERIFY_REPO=https://github.com/numpy/numpy-release
+PYTHON_COMPAT=( python3_{13..14} )
+PYTHON_REQ_USE="threads(+)"
+FORTRAN_NEEDED=lapack
+
+inherit distutils-r1 flag-o-matic fortran-2 pypi
+
+DESCRIPTION="Fast array and numerical python library"
+HOMEPAGE="
+ https://numpy.org/
+ https://github.com/numpy/numpy/
+ https://pypi.org/project/numpy/
+"
+
+LICENSE="BSD 0BSD MIT ZLIB CC0-1.0"
+SLOT="0/2"
+if [[ ${PV} != *_rc* ]]; then
+ KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+fi
+# +lapack because the internal fallbacks are pretty slow. Building without blas
+# is barely supported anyway, see bug #914358.
+IUSE="big-endian +cpudetection index64 +lapack"
+
+# upstream-flag[:gentoo-flag]
+ARM_FLAGS=( neon{,-fp16} vfpv4 asimd{,hp,dp,fhm} sve )
+PPC_FLAGS=( vsx vsx2 vsx3 vsx4 )
+X86_FLAGS=(
+ avx2 avx512{bw,dq,vl} avx512_{bf16,bitalg,fp16,vbmi2} sse4_2
+)
+IUSE+="
+ ${ARM_FLAGS[*]/#/cpu_flags_arm_}
+ ${PPC_FLAGS[*]/#/cpu_flags_ppc_}
+ ${X86_FLAGS[*]/#/cpu_flags_x86_}
+"
+
+RDEPEND="
+ lapack? (
+ >=virtual/cblas-3.8[index64(-)?]
+ >=virtual/lapack-3.8[index64(-)?]
+ )
+"
+BDEPEND="
+ ${RDEPEND}
+ >=dev-build/meson-1.5.2
+ >=dev-python/cython-3.0.6[${PYTHON_USEDEP}]
+ lapack? (
+ virtual/pkgconfig
+ )
+ test? (
+ $(python_gen_cond_dep '
+ >=dev-python/cffi-1.14.0[${PYTHON_USEDEP}]
+ ' 'python*')
+ dev-python/charset-normalizer[${PYTHON_USEDEP}]
+ >=dev-python/pytz-2019.3[${PYTHON_USEDEP}]
+ )
+"
+
+QA_CONFIG_IMPL_DECL_SKIP=(
+ # https://bugs.gentoo.org/925367
+ vrndq_f32
+)
+
+EPYTEST_PLUGINS=( hypothesis pytest-timeout )
+EPYTEST_XDIST=1
+distutils_enable_tests pytest
+
+has_all_x86() {
+ local flag
+ for flag; do
+ if ! use "cpu_flags_x86_${flag}"; then
+ return 1
+ fi
+ done
+ return 0
+}
+
+python_configure_all() {
+ local cpu_baseline=()
+ local map flag
+ case ${ARCH} in
+ arm)
+ # every flag implies the previous one
+ for map in NEON:neon NEON_FP16:neon-fp16 NEON_VFPV4:vfpv4; do
+ if ! use "cpu_flags_arm_${map#*:}"; then
+ break
+ fi
+ cpu_baseline+=( "${map%:*}" )
+ done
+ ;&
+ arm64)
+ # on 32-bit ARM, ASIMD implies all NEON* flags
+ # on 64-bit ARM, they are all linked together
+ if use arm64 ||
+ [[ ${cpu_baseline[@]} && ${cpu_baseline[-1]} == NEON_VFPV4 ]]
+ then
+ cpu_baseline+=( $(usev cpu_flags_arm_asimd ASIMD) )
+ fi
+
+ # these two imply ASIMD
+ if [[ ${cpu_baseline[@]} && ${cpu_baseline[-1]} == ASIMD ]]; then
+ for flag in dp hp; do
+ cpu_baseline+=(
+ $(usev "cpu_flags_arm_asimd${flag}" "ASIMD${flag^^}")
+ )
+ done
+ fi
+
+ # these two imply ASIMDHP
+ if [[ ${cpu_baseline[@]} && ${cpu_baseline[-1]} == ASIMDHP ]]; then
+ for flag in asimdfhm sve; do
+ cpu_baseline+=(
+ $(usev "cpu_flags_arm_${flag}" "${flag^^}")
+ )
+ done
+ fi
+ ;;
+ ppc64)
+ # every flag implies the previous one
+ for flag in '' 2 3 4; do
+ if ! use "cpu_flags_ppc_vsx${flags}"; then
+ break
+ fi
+ cpu_baseline+=( "VSX${flag}" )
+ done
+ ;;
+ amd64|x86)
+ # upstream combines multiple instructions into sets
+ local mapping=(
+ # for these, we just check the newest instruction set,
+ # since all earlier instruction sets imply it
+ "X86_V2=sse4_2"
+ "X86_V3=avx2"
+ # from here on, we check all features that were added
+ # in the lowest CPU supporting them all
+ # https://en.wikipedia.org/wiki/AVX-512
+ "X86_V4=avx512bw avx512dq avx512vl"
+ "AVX512_ICL=avx512_vbmi2 avx512_bitalg"
+ "AVX512_SPR=avx512_bf16 avx512_fp16"
+ )
+
+ local m
+ for m in "${mapping[@]}"; do
+ local feature=${m%=*}
+ local sets=${m#*=}
+
+ if has_all_x86 ${sets}; then
+ einfo "${feature} enabled: all of ${sets} enabled"
+ cpu_baseline+=( "${feature}" )
+ else
+ einfo "${feature} disabled: not all of ${sets} enabled"
+ break
+ fi
+ done
+ ;;
+ *)
+ cpu_baseline=MIN
+ ;;
+ esac
+
+ DISTUTILS_ARGS=(
+ -Dallow-noblas=$(usex !lapack true false)
+ -Duse-ilp64=$(usex index64 true false)
+ -Dblas=$(usev lapack $(usex index64 cblas64 cblas))
+ -Dlapack=$(usev lapack $(usex index64 lapack64 lapack))
+ -Dcpu-baseline="${cpu_baseline[*]}"
+ -Dcpu-baseline-detect=disabled
+ -Dcpu-dispatch="$(usev cpudetection MAX)"
+ )
+
+ # bug #922457
+ filter-lto
+ # https://github.com/numpy/numpy/issues/25004
+ append-flags -fno-strict-aliasing
+}
+
+python_test() {
+ # We run tests in parallel, so avoid having n^2 threads in lapack
+ # tests.
+ local -x BLIS_NUM_THREADS=1
+ local -x MKL_NUM_THREADS=1
+ local -x OMP_NUM_THREADS=1
+ local -x OPENBLAS_NUM_THREADS=1
+
+ # don't run tests that require more than 2 GiB of RAM (per process)
+ local -x NPY_AVAILABLE_MEM="2 GiB"
+
+ local EPYTEST_DESELECT=(
+ # Very disk-and-memory-hungry
+ numpy/lib/tests/test_io.py::TestSavezLoad::test_closing_fid
+ numpy/lib/tests/test_io.py::TestSavezLoad::test_closing_zipfile_after_load
+
+ # Precision problems
+ numpy/_core/tests/test_umath_accuracy.py::TestAccuracy::test_validate_transcendentals
+
+ numpy/typing/tests/test_typing.py
+
+ # Flaky, reruns don't help
+ numpy/f2py/tests/test_crackfortran.py
+ numpy/f2py/tests/test_data.py::TestData{,F77}::test_crackedlines
+ numpy/f2py/tests/test_f2py2e.py::test_gen_pyf
+ numpy/f2py/tests/test_f2py2e.py::test_gh22819_cli
+
+ # Broken by new setuptools
+ numpy/distutils/tests/test_fcompiler.py
+ numpy/distutils/tests/test_fcompiler_gnu.py
+ numpy/distutils/tests/test_fcompiler_intel.py
+ numpy/distutils/tests/test_fcompiler_nagfor.py
+ )
+
+ if [[ $(uname -m) == armv8l ]]; then
+ # Degenerate case of arm32 chroot on arm64, bug #774108
+ EPYTEST_DESELECT+=(
+ numpy/_core/tests/test_cpu_features.py::Test_ARM_Features::test_features
+ )
+ fi
+
+ case ${ARCH} in
+ arm)
+ EPYTEST_DESELECT+=(
+ # TODO: warnings
+ numpy/_core/tests/test_umath.py::TestSpecialFloats::test_unary_spurious_fpexception
+
+ # TODO
+ numpy/_core/tests/test_function_base.py::TestLinspace::test_denormal_numbers
+ numpy/f2py/tests/test_kind.py::TestKind::test_real
+ numpy/f2py/tests/test_kind.py::TestKind::test_quad_precision
+
+ # require too much memory
+ 'numpy/_core/tests/test_multiarray.py::TestDot::test_huge_vectordot[complex128]'
+ 'numpy/_core/tests/test_multiarray.py::TestDot::test_huge_vectordot[float64]'
+ )
+ ;;
+ hppa)
+ EPYTEST_DESELECT+=(
+ # https://bugs.gentoo.org/942689
+ "numpy/_core/tests/test_dtype.py::TestBuiltin::test_dtype[int]"
+ "numpy/_core/tests/test_dtype.py::TestBuiltin::test_dtype[float]"
+ "numpy/_core/tests/test_dtype.py::TestBuiltin::test_dtype_bytes_str_equivalence[datetime64]"
+ "numpy/_core/tests/test_dtype.py::TestBuiltin::test_dtype_bytes_str_equivalence[timedelta64]"
+ "numpy/_core/tests/test_dtype.py::TestBuiltin::test_dtype_bytes_str_equivalence[<f]"
+ "numpy/_core/tests/test_dtype.py::TestPickling::test_pickle_dtype[dt28]"
+ numpy/f2py/tests/test_kind.py::TestKind::test_real
+ numpy/f2py/tests/test_kind.py::TestKind::test_quad_precision
+ numpy/tests/test_ctypeslib.py::TestAsArray::test_reference_cycles
+ numpy/tests/test_ctypeslib.py::TestAsArray::test_segmentation_fault
+ numpy/tests/test_ctypeslib.py::TestAsCtypesType::test_scalar
+ numpy/tests/test_ctypeslib.py::TestAsCtypesType::test_subarray
+ numpy/tests/test_ctypeslib.py::TestAsCtypesType::test_structure
+ numpy/tests/test_ctypeslib.py::TestAsCtypesType::test_structure_aligned
+ numpy/tests/test_ctypeslib.py::TestAsCtypesType::test_union
+ numpy/tests/test_ctypeslib.py::TestAsCtypesType::test_padded_union
+ )
+ ;;
+ ppc|x86)
+ EPYTEST_DESELECT+=(
+ # require too much memory
+ 'numpy/_core/tests/test_multiarray.py::TestDot::test_huge_vectordot[complex128]'
+ 'numpy/_core/tests/test_multiarray.py::TestDot::test_huge_vectordot[float64]'
+ )
+ ;;
+ esac
+
+ if [[ ${CHOST} == powerpc64le-* ]]; then
+ EPYTEST_DESELECT+=(
+ # long double thingy
+ numpy/_core/tests/test_scalarprint.py::TestRealScalars::test_ppc64_ibm_double_double128
+ )
+ fi
+
+ if use big-endian; then
+ EPYTEST_DESELECT+=(
+ # ppc64 and sparc
+ numpy/linalg/tests/test_linalg.py::TestDet::test_generalized_sq_cases
+ numpy/linalg/tests/test_linalg.py::TestDet::test_sq_cases
+ "numpy/f2py/tests/test_return_character.py::TestFReturnCharacter::test_all_f77[s1]"
+ "numpy/f2py/tests/test_return_character.py::TestFReturnCharacter::test_all_f77[t1]"
+ "numpy/f2py/tests/test_return_character.py::TestFReturnCharacter::test_all_f90[s1]"
+ "numpy/f2py/tests/test_return_character.py::TestFReturnCharacter::test_all_f90[t1]"
+ )
+ fi
+
+ if ! has_version -b "~${CATEGORY}/${P}[${PYTHON_USEDEP}]" ; then
+ # depends on importing numpy.random from system namespace
+ EPYTEST_DESELECT+=(
+ 'numpy/random/tests/test_extending.py::test_cython'
+ )
+ fi
+
+ if has_version ">=dev-python/setuptools-74[${PYTHON_USEDEP}]"; then
+ # msvccompiler removal
+ EPYTEST_DESELECT+=(
+ numpy/tests/test_public_api.py::test_all_modules_are_expected_2
+ numpy/tests/test_public_api.py::test_api_importable
+ )
+ EPYTEST_IGNORE+=(
+ numpy/distutils/tests/test_mingw32ccompiler.py
+ numpy/distutils/tests/test_system_info.py
+ )
+ fi
+
+ case ${EPYTHON} in
+ pypy3.11)
+ EPYTEST_DESELECT+=(
+ numpy/_core/tests/test_regression.py::TestRegression::test_buffer_hashlib
+ numpy/random/tests/test_generator_mt19937.py::TestIntegers::test_repeatability
+ numpy/random/tests/test_generator_mt19937.py::TestRandomDist::test_choice_large_sample
+ numpy/random/tests/test_generator_mt19937.py::test_jumped
+ numpy/random/tests/test_random.py::TestRandint::test_repeatability
+ numpy/random/tests/test_randomstate.py::TestRandint::test_repeatability
+ numpy/random/tests/test_randomstate.py::test_integer_repeat
+ )
+ ;;
+ esac
+
+ cd "${BUILD_DIR}/install$(python_get_sitedir)" || die
+ epytest
+}
+
+python_install_all() {
+ local DOCS=( LICENSE.txt README.md THANKS.txt )
+ distutils-r1_python_install_all
+}
diff --git a/dev-python/numpy/numpy-2.5.0_rc1.ebuild b/dev-python/numpy/numpy-2.5.0_rc1.ebuild
new file mode 100644
index 000000000000..dda0acf87827
--- /dev/null
+++ b/dev-python/numpy/numpy-2.5.0_rc1.ebuild
@@ -0,0 +1,329 @@
+# Copyright 1999-2026 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+DISTUTILS_EXT=1
+DISTUTILS_USE_PEP517=meson-python
+PYPI_VERIFY_REPO=https://github.com/numpy/numpy-release
+PYTHON_COMPAT=( python3_{13..14} )
+PYTHON_REQ_USE="threads(+)"
+FORTRAN_NEEDED=lapack
+
+inherit distutils-r1 flag-o-matic fortran-2 pypi
+
+DESCRIPTION="Fast array and numerical python library"
+HOMEPAGE="
+ https://numpy.org/
+ https://github.com/numpy/numpy/
+ https://pypi.org/project/numpy/
+"
+
+LICENSE="BSD 0BSD MIT ZLIB CC0-1.0"
+SLOT="0/2"
+if [[ ${PV} != *_rc* ]]; then
+ KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+fi
+# +lapack because the internal fallbacks are pretty slow. Building without blas
+# is barely supported anyway, see bug #914358.
+IUSE="big-endian +cpudetection index64 +lapack"
+
+# upstream-flag[:gentoo-flag]
+ARM_FLAGS=( neon{,-fp16} vfpv4 asimd{,hp,dp,fhm} sve )
+PPC_FLAGS=( vsx vsx2 vsx3 vsx4 )
+X86_FLAGS=(
+ avx2 avx512{bw,dq,vl} avx512_{bf16,bitalg,fp16,vbmi2} sse4_2
+)
+IUSE+="
+ ${ARM_FLAGS[*]/#/cpu_flags_arm_}
+ ${PPC_FLAGS[*]/#/cpu_flags_ppc_}
+ ${X86_FLAGS[*]/#/cpu_flags_x86_}
+"
+
+RDEPEND="
+ lapack? (
+ >=virtual/cblas-3.8[index64(-)?]
+ >=virtual/lapack-3.8[index64(-)?]
+ )
+"
+BDEPEND="
+ ${RDEPEND}
+ >=dev-build/meson-1.5.2
+ >=dev-python/cython-3.0.6[${PYTHON_USEDEP}]
+ lapack? (
+ virtual/pkgconfig
+ )
+ test? (
+ $(python_gen_cond_dep '
+ >=dev-python/cffi-1.14.0[${PYTHON_USEDEP}]
+ ' 'python*')
+ dev-python/charset-normalizer[${PYTHON_USEDEP}]
+ >=dev-python/pytz-2019.3[${PYTHON_USEDEP}]
+ )
+"
+
+QA_CONFIG_IMPL_DECL_SKIP=(
+ # https://bugs.gentoo.org/925367
+ vrndq_f32
+)
+
+EPYTEST_PLUGINS=( hypothesis pytest-timeout )
+EPYTEST_XDIST=1
+distutils_enable_tests pytest
+
+has_all_x86() {
+ local flag
+ for flag; do
+ if ! use "cpu_flags_x86_${flag}"; then
+ return 1
+ fi
+ done
+ return 0
+}
+
+python_configure_all() {
+ local cpu_baseline=()
+ local map flag
+ case ${ARCH} in
+ arm)
+ # every flag implies the previous one
+ for map in NEON:neon NEON_FP16:neon-fp16 NEON_VFPV4:vfpv4; do
+ if ! use "cpu_flags_arm_${map#*:}"; then
+ break
+ fi
+ cpu_baseline+=( "${map%:*}" )
+ done
+ ;&
+ arm64)
+ # on 32-bit ARM, ASIMD implies all NEON* flags
+ # on 64-bit ARM, they are all linked together
+ if use arm64 ||
+ [[ ${cpu_baseline[@]} && ${cpu_baseline[-1]} == NEON_VFPV4 ]]
+ then
+ cpu_baseline+=( $(usev cpu_flags_arm_asimd ASIMD) )
+ fi
+
+ # these two imply ASIMD
+ if [[ ${cpu_baseline[@]} && ${cpu_baseline[-1]} == ASIMD ]]; then
+ for flag in dp hp; do
+ cpu_baseline+=(
+ $(usev "cpu_flags_arm_asimd${flag}" "ASIMD${flag^^}")
+ )
+ done
+ fi
+
+ # these two imply ASIMDHP
+ if [[ ${cpu_baseline[@]} && ${cpu_baseline[-1]} == ASIMDHP ]]; then
+ for flag in asimdfhm sve; do
+ cpu_baseline+=(
+ $(usev "cpu_flags_arm_${flag}" "${flag^^}")
+ )
+ done
+ fi
+ ;;
+ ppc64)
+ # every flag implies the previous one
+ for flag in '' 2 3 4; do
+ if ! use "cpu_flags_ppc_vsx${flags}"; then
+ break
+ fi
+ cpu_baseline+=( "VSX${flag}" )
+ done
+ ;;
+ amd64|x86)
+ # upstream combines multiple instructions into sets
+ local mapping=(
+ # for these, we just check the newest instruction set,
+ # since all earlier instruction sets imply it
+ "X86_V2=sse4_2"
+ "X86_V3=avx2"
+ # from here on, we check all features that were added
+ # in the lowest CPU supporting them all
+ # https://en.wikipedia.org/wiki/AVX-512
+ "X86_V4=avx512bw avx512dq avx512vl"
+ "AVX512_ICL=avx512_vbmi2 avx512_bitalg"
+ "AVX512_SPR=avx512_bf16 avx512_fp16"
+ )
+
+ local m
+ for m in "${mapping[@]}"; do
+ local feature=${m%=*}
+ local sets=${m#*=}
+
+ if has_all_x86 ${sets}; then
+ einfo "${feature} enabled: all of ${sets} enabled"
+ cpu_baseline+=( "${feature}" )
+ else
+ einfo "${feature} disabled: not all of ${sets} enabled"
+ break
+ fi
+ done
+ ;;
+ *)
+ cpu_baseline=MIN
+ ;;
+ esac
+
+ DISTUTILS_ARGS=(
+ -Dallow-noblas=$(usex !lapack true false)
+ -Duse-ilp64=$(usex index64 true false)
+ -Dblas=$(usev lapack $(usex index64 cblas64 cblas))
+ -Dlapack=$(usev lapack $(usex index64 lapack64 lapack))
+ -Dcpu-baseline="${cpu_baseline[*]}"
+ -Dcpu-baseline-detect=disabled
+ -Dcpu-dispatch="$(usev cpudetection MAX)"
+ )
+
+ # bug #922457
+ filter-lto
+ # https://github.com/numpy/numpy/issues/25004
+ append-flags -fno-strict-aliasing
+}
+
+python_test() {
+ # We run tests in parallel, so avoid having n^2 threads in lapack
+ # tests.
+ local -x BLIS_NUM_THREADS=1
+ local -x MKL_NUM_THREADS=1
+ local -x OMP_NUM_THREADS=1
+ local -x OPENBLAS_NUM_THREADS=1
+
+ # don't run tests that require more than 2 GiB of RAM (per process)
+ local -x NPY_AVAILABLE_MEM="2 GiB"
+
+ local EPYTEST_DESELECT=(
+ # Very disk-and-memory-hungry
+ numpy/lib/tests/test_io.py::TestSavezLoad::test_closing_fid
+ numpy/lib/tests/test_io.py::TestSavezLoad::test_closing_zipfile_after_load
+
+ # Precision problems
+ numpy/_core/tests/test_umath_accuracy.py::TestAccuracy::test_validate_transcendentals
+
+ numpy/typing/tests/test_typing.py
+
+ # Flaky, reruns don't help
+ numpy/f2py/tests/test_crackfortran.py
+ numpy/f2py/tests/test_data.py::TestData{,F77}::test_crackedlines
+ numpy/f2py/tests/test_f2py2e.py::test_gen_pyf
+ numpy/f2py/tests/test_f2py2e.py::test_gh22819_cli
+
+ # Broken by new setuptools
+ numpy/distutils/tests/test_fcompiler.py
+ numpy/distutils/tests/test_fcompiler_gnu.py
+ numpy/distutils/tests/test_fcompiler_intel.py
+ numpy/distutils/tests/test_fcompiler_nagfor.py
+ )
+
+ if [[ $(uname -m) == armv8l ]]; then
+ # Degenerate case of arm32 chroot on arm64, bug #774108
+ EPYTEST_DESELECT+=(
+ numpy/_core/tests/test_cpu_features.py::Test_ARM_Features::test_features
+ )
+ fi
+
+ case ${ARCH} in
+ arm)
+ EPYTEST_DESELECT+=(
+ # TODO: warnings
+ numpy/_core/tests/test_umath.py::TestSpecialFloats::test_unary_spurious_fpexception
+
+ # TODO
+ numpy/_core/tests/test_function_base.py::TestLinspace::test_denormal_numbers
+ numpy/f2py/tests/test_kind.py::TestKind::test_real
+ numpy/f2py/tests/test_kind.py::TestKind::test_quad_precision
+
+ # require too much memory
+ 'numpy/_core/tests/test_multiarray.py::TestDot::test_huge_vectordot[complex128]'
+ 'numpy/_core/tests/test_multiarray.py::TestDot::test_huge_vectordot[float64]'
+ )
+ ;;
+ hppa)
+ EPYTEST_DESELECT+=(
+ # https://bugs.gentoo.org/942689
+ "numpy/_core/tests/test_dtype.py::TestBuiltin::test_dtype[int]"
+ "numpy/_core/tests/test_dtype.py::TestBuiltin::test_dtype[float]"
+ "numpy/_core/tests/test_dtype.py::TestBuiltin::test_dtype_bytes_str_equivalence[datetime64]"
+ "numpy/_core/tests/test_dtype.py::TestBuiltin::test_dtype_bytes_str_equivalence[timedelta64]"
+ "numpy/_core/tests/test_dtype.py::TestBuiltin::test_dtype_bytes_str_equivalence[<f]"
+ "numpy/_core/tests/test_dtype.py::TestPickling::test_pickle_dtype[dt28]"
+ numpy/f2py/tests/test_kind.py::TestKind::test_real
+ numpy/f2py/tests/test_kind.py::TestKind::test_quad_precision
+ numpy/tests/test_ctypeslib.py::TestAsArray::test_reference_cycles
+ numpy/tests/test_ctypeslib.py::TestAsArray::test_segmentation_fault
+ numpy/tests/test_ctypeslib.py::TestAsCtypesType::test_scalar
+ numpy/tests/test_ctypeslib.py::TestAsCtypesType::test_subarray
+ numpy/tests/test_ctypeslib.py::TestAsCtypesType::test_structure
+ numpy/tests/test_ctypeslib.py::TestAsCtypesType::test_structure_aligned
+ numpy/tests/test_ctypeslib.py::TestAsCtypesType::test_union
+ numpy/tests/test_ctypeslib.py::TestAsCtypesType::test_padded_union
+ )
+ ;;
+ ppc|x86)
+ EPYTEST_DESELECT+=(
+ # require too much memory
+ 'numpy/_core/tests/test_multiarray.py::TestDot::test_huge_vectordot[complex128]'
+ 'numpy/_core/tests/test_multiarray.py::TestDot::test_huge_vectordot[float64]'
+ )
+ ;;
+ esac
+
+ if [[ ${CHOST} == powerpc64le-* ]]; then
+ EPYTEST_DESELECT+=(
+ # long double thingy
+ numpy/_core/tests/test_scalarprint.py::TestRealScalars::test_ppc64_ibm_double_double128
+ )
+ fi
+
+ if use big-endian; then
+ EPYTEST_DESELECT+=(
+ # ppc64 and sparc
+ numpy/linalg/tests/test_linalg.py::TestDet::test_generalized_sq_cases
+ numpy/linalg/tests/test_linalg.py::TestDet::test_sq_cases
+ "numpy/f2py/tests/test_return_character.py::TestFReturnCharacter::test_all_f77[s1]"
+ "numpy/f2py/tests/test_return_character.py::TestFReturnCharacter::test_all_f77[t1]"
+ "numpy/f2py/tests/test_return_character.py::TestFReturnCharacter::test_all_f90[s1]"
+ "numpy/f2py/tests/test_return_character.py::TestFReturnCharacter::test_all_f90[t1]"
+ )
+ fi
+
+ if ! has_version -b "~${CATEGORY}/${P}[${PYTHON_USEDEP}]" ; then
+ # depends on importing numpy.random from system namespace
+ EPYTEST_DESELECT+=(
+ 'numpy/random/tests/test_extending.py::test_cython'
+ )
+ fi
+
+ if has_version ">=dev-python/setuptools-74[${PYTHON_USEDEP}]"; then
+ # msvccompiler removal
+ EPYTEST_DESELECT+=(
+ numpy/tests/test_public_api.py::test_all_modules_are_expected_2
+ numpy/tests/test_public_api.py::test_api_importable
+ )
+ EPYTEST_IGNORE+=(
+ numpy/distutils/tests/test_mingw32ccompiler.py
+ numpy/distutils/tests/test_system_info.py
+ )
+ fi
+
+ case ${EPYTHON} in
+ pypy3.11)
+ EPYTEST_DESELECT+=(
+ numpy/_core/tests/test_regression.py::TestRegression::test_buffer_hashlib
+ numpy/random/tests/test_generator_mt19937.py::TestIntegers::test_repeatability
+ numpy/random/tests/test_generator_mt19937.py::TestRandomDist::test_choice_large_sample
+ numpy/random/tests/test_generator_mt19937.py::test_jumped
+ numpy/random/tests/test_random.py::TestRandint::test_repeatability
+ numpy/random/tests/test_randomstate.py::TestRandint::test_repeatability
+ numpy/random/tests/test_randomstate.py::test_integer_repeat
+ )
+ ;;
+ esac
+
+ cd "${BUILD_DIR}/install$(python_get_sitedir)" || die
+ epytest
+}
+
+python_install_all() {
+ local DOCS=( LICENSE.txt README.md THANKS.txt )
+ distutils-r1_python_install_all
+}