Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MNT: Pin numpy<2 for v5.3.x #15234

Merged
merged 2 commits into from Aug 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 3 additions & 12 deletions astropy/modeling/tests/test_constraints.py
Expand Up @@ -14,13 +14,9 @@
from astropy.modeling import fitting, models
from astropy.modeling.core import Fittable1DModel
from astropy.modeling.parameters import Parameter
from astropy.utils import minversion
from astropy.utils.compat.numpycompat import NUMPY_LT_2_0
from astropy.utils.compat.optional_deps import HAS_SCIPY
from astropy.utils.exceptions import AstropyUserWarning

SCIPY_LT_1_11_2 = not minversion("scipy", "1.11.2") if HAS_SCIPY else True

fitters = [
fitting.LevMarLSQFitter,
fitting.TRFLSQFitter,
Expand Down Expand Up @@ -184,6 +180,7 @@ def test_bounds_slsqp(self):
assert intercept + 10**-5 >= bounds["intercept"][0]
assert intercept - 10**-5 <= bounds["intercept"][1]

@pytest.mark.filterwarnings("ignore:The fit may be unsuccessful")
@pytest.mark.parametrize("fitter", fitters)
def test_bounds_gauss2d_lsq(self, fitter):
fitter = fitter()
Expand All @@ -205,19 +202,13 @@ def test_bounds_gauss2d_lsq(self, fitter):
bounds=bounds,
)
if isinstance(fitter, (fitting.LevMarLSQFitter, fitting.DogBoxLSQFitter)):
with pytest.warns(AstropyUserWarning, match="The fit may be unsuccessful"):
model = fitter(gauss, X, Y, self.data)
model = fitter(gauss, X, Y, self.data)
else:
ctx2 = nullcontext()
if isinstance(fitter, fitting.TRFLSQFitter):
ctx = np.errstate(invalid="ignore", divide="ignore")
if not NUMPY_LT_2_0 or not SCIPY_LT_1_11_2:
ctx2 = pytest.warns(
AstropyUserWarning, match="The fit may be unsuccessful"
)
else:
ctx = nullcontext()
with ctx, ctx2:
with ctx:
model = fitter(gauss, X, Y, self.data)
x_mean = model.x_mean.value
y_mean = model.y_mean.value
Expand Down
1 change: 1 addition & 0 deletions docs/changes/15234.other.rst
@@ -0,0 +1 @@
v5.3.x will not support NumPy 2.0 or later.
2 changes: 1 addition & 1 deletion pyproject.toml
Expand Up @@ -2,7 +2,7 @@
requires = ["setuptools",
"setuptools_scm>=6.2",
"cython==0.29.34",
"oldest-supported-numpy",
"numpy>=1.25,<2",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason to have the minimum build version higher than the minimum runtime version? That’s generally the thing that has caused problems in the past and is the reason for oldest-supported-numpy.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Numpy 1.25 is the first version that supports backward compatible builds. The release notes explicitly mention that the mechanism makes oldest-supported-numpy not needed

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More discussions happened in #14949

"extension-helpers"]
build-backend = 'setuptools.build_meta'

Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Expand Up @@ -28,7 +28,7 @@ packages = find:
zip_safe = False
tests_require = pytest-astropy
install_requires =
numpy>=1.21
numpy>=1.21,<2
pyerfa>=2.0
PyYAML>=3.13
packaging>=19.0
Expand Down
1 change: 0 additions & 1 deletion tox.ini
Expand Up @@ -86,7 +86,6 @@ deps =
# or nightly wheel of key dependencies.
# Do not install asdf-astropy so we can test astropy.io.misc.asdf until we remove it.
devdeps: scipy>=0.0.dev0
devdeps: numpy>=0.0.dev0
devdeps: matplotlib>=0.0.dev0
devdeps: git+https://github.com/asdf-format/asdf.git#egg=asdf
devdeps: git+https://github.com/liberfa/pyerfa.git#egg=pyerfa
Expand Down