Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-sherpa for openSUSE:Factory checked in at 2023-09-10 13:10:01 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-sherpa (Old) and /work/SRC/openSUSE:Factory/.python-sherpa.new.1766 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-sherpa" Sun Sep 10 13:10:01 2023 rev:17 rq:1109765 version:4.15.1 Changes: -------- --- /work/SRC/openSUSE:Factory/python-sherpa/python-sherpa.changes 2023-05-30 22:02:23.438991991 +0200 +++ /work/SRC/openSUSE:Factory/.python-sherpa.new.1766/python-sherpa.changes 2023-09-10 13:10:37.763410019 +0200 @@ -1,0 +2,5 @@ +Thu Sep 7 12:24:59 UTC 2023 - Markéta Machová <[email protected]> + +- Add upstream patches numpy125.patch and numpy125-CI.patch + +------------------------------------------------------------------- New: ---- numpy125-CI.patch numpy125.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-sherpa.spec ++++++ --- /var/tmp/diff_new_pack.YSYJoB/_old 2023-09-10 13:10:40.015490480 +0200 +++ /var/tmp/diff_new_pack.YSYJoB/_new 2023-09-10 13:10:40.015490480 +0200 @@ -24,6 +24,10 @@ URL: https://github.com/sherpa/sherpa/ Source0: https://github.com/sherpa/sherpa/archive/%{version}.tar.gz#/sherpa-%{version}.tar.gz Source1: https://github.com/sherpa/sherpa-test-data/archive/refs/tags/%{version}.tar.gz#/sherpa-test-data-%{version}.tar.gz +# PATCH-FIX-UPSTREAM https://github.com/sherpa/sherpa/pull/1807 NumPy 1.25 support +Patch: numpy125.patch +# PATCH-FIX-UPSTREAM https://github.com/sherpa/sherpa/pull/1819 CI: hide NumPy 1.25 array ndim>0 deprecation warnings +Patch: numpy125-CI.patch BuildRequires: %{python_module devel >= 3.8} BuildRequires: %{python_module numpy-devel >= 1.19} BuildRequires: %{python_module pip} @@ -54,7 +58,7 @@ data, using a variety of statistics and optimization methods. %prep -%setup -q -n sherpa-%{version} -a1 +%autosetup -p1 -n sherpa-%{version} -a1 # uncomment system libs https://sherpa.readthedocs.io/en/latest/install.html#fftw sed -i "s|#fftw=local|fftw=local|" setup.cfg sed -i "s|#fftw-include[-_]dirs.*$|fftw-include-dirs=%{_includedir}|" setup.cfg ++++++ numpy125-CI.patch ++++++ >From 2aea86a2a596323e9c8e41275acbffa1e9a609a0 Mon Sep 17 00:00:00 2001 From: Doug Burke <[email protected]> Date: Mon, 17 Jul 2023 11:33:29 -0400 Subject: [PATCH 1/2] Silence test warnings if pytest-doctestplus is not installed I originally tried adding the warnings to sherpa/conftest.py but this is happening in pytest itself, so I've taken advantage of the general filter-warnings capability to hide thse messages. Before this change, running pytest without pytest-doctestplus would result in messages like ==================================================== warnings summary ===================================================== ../../../lagado2.real/local/anaconda/envs/sherpa-main/lib/python3.11/site-packages/_pytest/config/__init__.py:1373 /lagado2.real/local/anaconda/envs/sherpa-main/lib/python3.11/site-packages/_pytest/config/__init__.py:1373: PytestConfigWarning: Unknown config option: doctest_norecursedirs self._warn_or_fail_if_strict(f"Unknown config option: {key}\n") ../../../lagado2.real/local/anaconda/envs/sherpa-main/lib/python3.11/site-packages/_pytest/config/__init__.py:1373 /lagado2.real/local/anaconda/envs/sherpa-main/lib/python3.11/site-packages/_pytest/config/__init__.py:1373: PytestConfigWarning: Unknown config option: doctest_plus self._warn_or_fail_if_strict(f"Unknown config option: {key}\n") ../../../lagado2.real/local/anaconda/envs/sherpa-main/lib/python3.11/site-packages/_pytest/config/__init__.py:1373 /lagado2.real/local/anaconda/envs/sherpa-main/lib/python3.11/site-packages/_pytest/config/__init__.py:1373: PytestConfigWarning: Unknown config option: doctest_plus_atol self._warn_or_fail_if_strict(f"Unknown config option: {key}\n") ../../../lagado2.real/local/anaconda/envs/sherpa-main/lib/python3.11/site-packages/_pytest/config/__init__.py:1373 /lagado2.real/local/anaconda/envs/sherpa-main/lib/python3.11/site-packages/_pytest/config/__init__.py:1373: PytestConfigWarning: Unknown config option: doctest_subpackage_requires self._warn_or_fail_if_strict(f"Unknown config option: {key}\n") ../../../lagado2.real/local/anaconda/envs/sherpa-main/lib/python3.11/site-packages/_pytest/config/__init__.py:1373 /lagado2.real/local/anaconda/envs/sherpa-main/lib/python3.11/site-packages/_pytest/config/__init__.py:1373: PytestConfigWarning: Unknown config option: text_file_format self._warn_or_fail_if_strict(f"Unknown config option: {key}\n") -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html ================================================= short test summary info ================================================= --- pytest.ini | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pytest.ini b/pytest.ini index fde2ab8e0c..e2c4c4847e 100644 --- a/pytest.ini +++ b/pytest.ini @@ -2,6 +2,10 @@ addopts = -rs --ignore=setup.py --ignore=test_requirements.txt norecursedirs = .git build dist tmp* .eggs text_file_format = rst +filterwarnings = + # Since we can runpytest without loading pytest-doctestplus, hide + # the warnings we get when this is done + ignore::pytest.PytestConfigWarning doctest_plus = enabled doctest_plus_atol = 1e-4 doctest_optionflags = >From 14e43a098ecb9a5068d2886f6d4680b9cd878404 Mon Sep 17 00:00:00 2001 From: Doug Burke <[email protected]> Date: Mon, 17 Jul 2023 12:05:21 -0400 Subject: [PATCH 2/2] Tests: hide NumPy 1.25 ndim > 0 warnings (crates) Although Sherpa has been updated to remove the deprecation warnnng from NumPy 1.25: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) it is still present in Crates (mid 2023), so hide the warning with the assumption we can revert this commit by mid December 2023. --- sherpa/conftest.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sherpa/conftest.py b/sherpa/conftest.py index 97979b4e4b..339f252a51 100644 --- a/sherpa/conftest.py +++ b/sherpa/conftest.py @@ -117,6 +117,11 @@ def pytest_collection_modifyitems(config, items): r'np.asscalar\(a\) is deprecated since NumPy v1.16, use a.item\(\) instead', r"Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3,and in 3.9 it will stop working", + # NumPy 1.25 warnings that are raised by (mid-2023) crates code. + # Hopefully this can be removed by December 2023. + # + r"Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. \(Deprecated NumPy 1.25.\)", + ], UserWarning: [ ++++++ numpy125.patch ++++++ >From 740fcd0da87d3aefa41aa3962cc8f1ddb7ab3cab Mon Sep 17 00:00:00 2001 From: Doug Burke <[email protected]> Date: Tue, 20 Jun 2023 15:31:55 -0400 Subject: [PATCH] NumPy 1.25 support NumPy 1.25 deprecates converting a ndarray that is not a 0d value, so for our cases this is int(value) info("message %g", value) where value is a ndarray of length 1. The simple fix is to explictly access the first element - so answer = int(value[0]) info("message %g", value[0]) although for the int case (in the PSF convolution instrument code) I have not looked through to determine if value is always guaranteed to be a ndarray, so it is more like if np.isscalar(value): newval = value else: newval = value[0] answer = int(newval) --- sherpa/fit.py | 13 +++++++++---- sherpa/instrument.py | 12 ++++++++++-- 2 files changed, 19 insertions(+), 6 deletions(-) Index: sherpa-4.15.1/sherpa/fit.py =================================================================== --- sherpa-4.15.1.orig/sherpa/fit.py +++ sherpa-4.15.1/sherpa/fit.py @@ -1258,8 +1258,13 @@ class Fit(NoNewAttributesAfterInit): def get_par_name(ii): return self.model.pars[self.thaw_indices[ii]].fullname - # Call from a parameter estimation method, to report - # that limits for a given parameter have been found + # Call from a parameter estimation method, to report that + # limits for a given parameter have been found At present (mid + # 2023) it looks like lower/upper are both single-element + # ndarrays, hence the need to convert to a scalar by accessing + # the first element (otherwise there's a deprecation warning + # from NumPy 1.25). + # def report_progress(i, lower, upper): if i < 0: pass @@ -1268,11 +1273,11 @@ class Fit(NoNewAttributesAfterInit): if isnan(lower) or isinf(lower): info("%s \tlower bound: -----" % name) else: - info("%s \tlower bound: %g" % (name, lower)) + info("%s \tlower bound: %g" % (name, lower[0])) if isnan(upper) or isinf(upper): info("%s \tupper bound: -----" % name) else: - info("%s \tupper bound: %g" % (name, upper)) + info("%s \tupper bound: %g" % (name, upper[0])) # If starting fit statistic is chi-squared or C-stat, # can calculate reduced fit statistic -- if it is Index: sherpa-4.15.1/sherpa/instrument.py =================================================================== --- sherpa-4.15.1.orig/sherpa/instrument.py +++ sherpa-4.15.1/sherpa/instrument.py @@ -357,9 +357,17 @@ class PSFKernel(Kernel): # and Python 3.8 - causes a TypeError with the message # "only integer scalar arrays can be converted to a scalar index" # to be thrown here if sent directly to set_origin. So - # we convert to a Python integer type. + # we convert to a Python integer type. In NumPy 1.25 it became + # a deprecation error to call int on an array with ndim > 0. # - origin = set_origin(kshape, int(brightPixel)) + # assume there is only one element in brightPixel if not + # a scalar + # + if not numpy.isscalar(brightPixel): + loc = brightPixel[0] + else: + loc = brightPixel + origin = set_origin(kshape, int(loc)) if self.origin is None: self.origin = origin
