Accepting request 1223649 from devel:languages:python:numeric

- Add upstream patch fix-test-max-threads-unset.patch
- Remove upstreamed patch numexpr-pr485-allow-numpy1.patch
- Update to 2.10.1:
  - The default number of 'safe' threads has been upgraded to 16
    (instead of previous 8). That means that if your CPU has > 16
    cores, the default is to use 16. You can always override this with
    the "NUMEXPR_MAX_THREADS" environment variable.
  - NumPy 1.23 is now the minimum supported.
  - Preliminary support for Python 3.13. Thanks to Karolina Surma.
  - Fix tests on nthreads detection (closes: #479). Thanks to
    @avalentino.
  - The build process has been modernized and now uses the
    pyproject.toml file for more of the configuration options.

OBS-URL: https://build.opensuse.org/request/show/1223649
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-numexpr?expand=0&rev=26
This commit is contained in:
Ana Guerrero 2024-11-12 18:23:59 +00:00 committed by Git OBS Bridge
commit 70936695f9
6 changed files with 44 additions and 37 deletions

View File

@ -0,0 +1,13 @@
Index: numexpr-2.10.1/numexpr/tests/test_numexpr.py
===================================================================
--- numexpr-2.10.1.orig/numexpr/tests/test_numexpr.py
+++ numexpr-2.10.1/numexpr/tests/test_numexpr.py
@@ -1129,7 +1129,7 @@ class test_threading_config(TestCase):
"if 'NUMEXPR_MAX_THREADS' in os.environ: os.environ.pop('NUMEXPR_MAX_THREADS')",
"if 'OMP_NUM_THREADS' in os.environ: os.environ.pop('OMP_NUM_THREADS')",
"import numexpr",
- "assert(numexpr.nthreads <= 8)",
+ f"assert(numexpr.nthreads <= {MAX_THREADS})",
"exit(0)"])
subprocess.check_call([sys.executable, '-c', script])

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:c89e930752639df040539160326d8f99a84159bbea41943ab8e960591edaaef0
size 103563

3
numexpr-2.10.1.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:9bba99d354a65f1a008ab8b87f07d84404c668e66bab624df5b6b5373403cf81
size 101580

View File

@ -1,28 +0,0 @@
From b35f5fcbd8447cb36268d0d344c8ef65b1912187 Mon Sep 17 00:00:00 2001
From: Sebastian Berg <sebastianb@nvidia.com>
Date: Wed, 8 May 2024 15:31:04 +0200
Subject: [PATCH] MAINT: Allow building with NumPy 1.x locally
I have build locally without build isolation and it seems to work
fine.
---
numexpr/interpreter.cpp | 6 ++++++
1 file changed, 6 insertions(+)
Index: numexpr-2.10.0/numexpr/interpreter.cpp
===================================================================
--- numexpr-2.10.0.orig/numexpr/interpreter.cpp
+++ numexpr-2.10.0/numexpr/interpreter.cpp
@@ -47,6 +47,12 @@
#define AVAILABLE(Haystack, Haystack_Len, J, Needle_Len) \
((Haystack_Len) >= (J) + (Needle_Len))
+// To allow building with NumPy<2 locally define the new NumPy macros:
+#if NPY_ABI_VERSION < 0x02000000
+ #define PyDataType_ELSIZE(descr) ((descr)->elsize)
+ #define PyDataType_SET_ELSIZE(descr, size) (descr)->elsize = size
+#endif
+
#include "str-two-way.hpp"
#ifdef DEBUG

View File

@ -1,3 +1,20 @@
-------------------------------------------------------------------
Tue Nov 12 11:14:53 UTC 2024 - Daniel Garcia <daniel.garcia@suse.com>
- Add upstream patch fix-test-max-threads-unset.patch
- Remove upstreamed patch numexpr-pr485-allow-numpy1.patch
- Update to 2.10.1:
- The default number of 'safe' threads has been upgraded to 16
(instead of previous 8). That means that if your CPU has > 16
cores, the default is to use 16. You can always override this with
the "NUMEXPR_MAX_THREADS" environment variable.
- NumPy 1.23 is now the minimum supported.
- Preliminary support for Python 3.13. Thanks to Karolina Surma.
- Fix tests on nthreads detection (closes: #479). Thanks to
@avalentino.
- The build process has been modernized and now uses the
pyproject.toml file for more of the configuration options.
-------------------------------------------------------------------
Sat May 11 19:48:33 UTC 2024 - Ben Greiner <code@bnavigator.de>

View File

@ -18,25 +18,24 @@
%{?sle15_python_module_pythons}
Name: python-numexpr
Version: 2.10.0
Version: 2.10.1
Release: 0
Summary: Numerical expression evaluator for NumPy
License: MIT
Group: Development/Languages/Python
URL: https://github.com/pydata/numexpr/
Source: https://files.pythonhosted.org/packages/source/n/numexpr/numexpr-%{version}.tar.gz
# PATCH-FIX-UPSTREAM numexpr-pr485-allow-numpy1.patch gh#pydata/numexpr#485, see also comments in gh#pydata/numexpr#478
Patch0: numexpr-pr485-allow-numpy1.patch
BuildRequires: %{python_module devel >= 3.7}
# Until numpy 2 is in Factory, keep allowing to build with numpy 1.x. See Patch0
BuildRequires: %{python_module numpy-devel >= 1.19.3}
# PATCH-FIX-UPSTREAM: fix-test-max-threads-unset.patch gh#pydata/numexpr#491
Patch0: fix-test-max-threads-unset.patch
BuildRequires: %{python_module numpy-devel >= 1.23}
BuildRequires: %{python_module pip}
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module wheel}
BuildRequires: fdupes
BuildRequires: gcc-c++
BuildRequires: python-rpm-macros
Requires: python-numpy >= 1.19.3
Requires: python-numpy >= 1.23
%python_subpackages
%description
@ -58,11 +57,17 @@ export CFLAGS="%{optflags} -fno-strict-aliasing"
%install
%pyproject_install
# Remove devel files
%{python_expand #
find %{buildroot}%{$python_sitearch} -name *.hpp -type f -delete
find %{buildroot}%{$python_sitearch} -name *.cpp -type f -delete
}
%python_expand %fdupes %{buildroot}%{$python_sitearch}
%check
mkdir tester
pushd tester
%{python_expand export PYTHONPATH=%{buildroot}%{$python_sitearch}
$python -B -c "import sys;import numexpr;sys.exit(0 if numexpr.test().wasSuccessful() else 1)"
}