Skip to content

Commit

Permalink
Merge pull request #19670 from tylerjereddy/treddy_1_12_version_pins
Browse files Browse the repository at this point in the history
WIP, MAINT: version bounds for 1.12.0rc1
  • Loading branch information
tylerjereddy committed Dec 20, 2023
2 parents 20d131e + 7d31622 commit 138cdbf
Show file tree
Hide file tree
Showing 23 changed files with 322 additions and 304 deletions.
18 changes: 0 additions & 18 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,24 +128,9 @@ jobs:
CIBW_BUILD: ${{ matrix.python[0] }}-${{ matrix.buildplat[1] }}*
CIBW_ARCHS: ${{ matrix.buildplat[2] }}
CIBW_ENVIRONMENT_PASS_LINUX: RUNNER_OS
CIBW_PRERELEASE_PYTHONS: True

# TODO remove the CIBW_BEFORE_BUILD_* lines once there are
# numpy2.0 wheels available on PyPI. Also remove/comment out the
# PIP_NO_BUILD_ISOLATION and PIP_EXTRA_INDEX_URL from CIBW_ENVIRONMENT
# (also for _MACOS and _WINDOWS below)
CIBW_BEFORE_BUILD_LINUX: "pip install numpy>=2.0.0.dev0 meson-python cython pythran pybind11 ninja; bash {project}/tools/wheels/cibw_before_build_linux.sh {project}"
CIBW_BEFORE_BUILD_WINDOWS: "pip install numpy>=2.0.0.dev0 meson-python cython pythran pybind11 ninja && bash {project}/tools/wheels/cibw_before_build_win.sh {project}"
CIBW_BEFORE_BUILD_MACOS: "pip install numpy>=2.0.0.dev0 meson-python cython pythran pybind11 ninja; bash {project}/tools/wheels/cibw_before_build_macos.sh {project}"
# Allow pip to find install nightly wheels if necessary
# Setting PIP_NO_BUILD_ISOLATION=false makes pip use build-isolation.
CIBW_ENVIRONMENT: "PIP_NO_BUILD_ISOLATION=false PIP_PRE=1 PIP_EXTRA_INDEX_URL=https://pypi.anaconda.org/scientific-python-nightly-wheels/simple"

CIBW_ENVIRONMENT_WINDOWS: >
PKG_CONFIG_PATH=c:/opt/64/lib/pkgconfig
PIP_PRE=1
PIP_EXTRA_INDEX_URL=https://pypi.anaconda.org/scientific-python-nightly-wheels/simple
PIP_NO_BUILD_ISOLATION=false
# setting SDKROOT necessary when using the gfortran compiler
# installed in cibw_before_build_macos.sh
Expand All @@ -159,9 +144,6 @@ jobs:
MACOSX_DEPLOYMENT_TARGET=10.9
MACOS_DEPLOYMENT_TARGET=10.9
_PYTHON_HOST_PLATFORM=macosx-10.9-x86_64
PIP_PRE=1
PIP_EXTRA_INDEX_URL=https://pypi.anaconda.org/scientific-python-nightly-wheels/simple
PIP_NO_BUILD_ISOLATION=false
CIBW_REPAIR_WHEEL_COMMAND_MACOS: >
DYLD_LIBRARY_PATH=/usr/local/lib delocate-listdeps {wheel} &&
Expand Down
16 changes: 1 addition & 15 deletions ci/cirrus_wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ build_and_store_wheels: &BUILD_AND_STORE_WHEELS
######################################################################

cirrus_wheels_linux_aarch64_task:
timeout_in: 75m
compute_engine_instance:
image_project: cirrus-images
image: family/docker-builder-arm64
Expand All @@ -27,15 +28,6 @@ cirrus_wheels_linux_aarch64_task:
CIBW_BUILD: cp39-manylinux* cp310-manylinux*
- env:
CIBW_BUILD: cp311-manylinux* cp312-manylinux*
env:
CIBW_PRERELEASE_PYTHONS: True
# TODO remove the CIBW_BEFORE_BUILD_LINUX line once there are numpy2.0 wheels available on PyPI.
# Also remove/comment out PIP_NO_BUILD_ISOLATION, PIP_EXTRA_INDEX_URL flags.
CIBW_BEFORE_BUILD_LINUX: "pip install numpy>=2.0.0.dev0 meson-python cython pythran pybind11 ninja;bash {project}/tools/wheels/cibw_before_build_linux.sh {project}"
CIBW_ENVIRONMENT: >
PIP_PRE=1
PIP_EXTRA_INDEX_URL=https://pypi.anaconda.org/scientific-python-nightly-wheels/simple
PIP_NO_BUILD_ISOLATION=false

build_script: |
apt install -y python3-venv python-is-python3
Expand Down Expand Up @@ -63,12 +55,6 @@ cirrus_wheels_macos_arm64_task:
CIBW_ENVIRONMENT: >
MACOSX_DEPLOYMENT_TARGET=12.0
_PYTHON_HOST_PLATFORM="macosx-12.0-arm64"
PIP_PRE=1
PIP_EXTRA_INDEX_URL=https://pypi.anaconda.org/scientific-python-nightly-wheels/simple
PIP_NO_BUILD_ISOLATION=false
# TODO remove the following line once there are numpy2.0 wheels available on PyPI.
# Also remove PIP_NO_BUILD_ISOLATION, PIP_EXTRA_INDEX_URL flags.
CIBW_BEFORE_BUILD_MACOS: "pip install numpy>=2.0.0.dev0 meson-python cython pythran pybind11 ninja;bash {project}/tools/wheels/cibw_before_build_macos.sh {project}"
PKG_CONFIG_PATH: /opt/arm64-builds/lib/pkgconfig
# assumes that the cmake config is in /usr/local/lib/cmake
CMAKE_PREFIX_PATH: /opt/arm64-builds/
Expand Down
61 changes: 34 additions & 27 deletions doc/source/dev/api-dev/array_api.rst
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
Support for Array API
=====================
Support for the array API standard
==================================

.. note:: Array API support is still experimental and hidden behind an
.. note:: array API standard support is still experimental and hidden behind an
environment variable. Only a small part of the public API is covered
right now.

This guide describes how to **use** and **add support for** the
`Python Array API standard <https://data-apis.org/array-api/latest/index.html>`_.
This standard allows users to use any Array API compatible array library
`Python array API standard <https://data-apis.org/array-api/latest/index.html>`_.
This standard allows users to use any array API compatible array library
with SciPy out of the box.

The `RFC`_ defines how SciPy implements support for the standard, with the main
Expand All @@ -16,13 +16,13 @@ implementation does more strict validation of allowed array-like inputs, e.g.
rejecting numpy matrix and masked array instances, and arrays with object
dtype.

In the following, an Array API compatible namespace is noted as ``xp``.
In the following, an array API compatible namespace is noted as ``xp``.


Using Array API support
-----------------------
Using array API standard support
--------------------------------

To enable the Array API standard support, an environment variable must be set
To enable the array API standard support, an environment variable must be set
before importing SciPy:

.. code:: bash
Expand Down Expand Up @@ -90,12 +90,19 @@ More strict array input validation will reject ``np.matrix`` and
Currently supported functionality
`````````````````````````````````

The following modules provide Array API standard support when the environment
The following modules provide array API standard support when the environment
variable is set:

- ``scipy.cluster.hierarchy``
- ``scipy.cluster.vq``
- ``scipy.fft``
- `scipy.cluster.hierarchy`
- `scipy.cluster.vq`
- `scipy.fft`

Support is provided in `scipy.special` for the following functions:
`scipy.special.log_ndtr`, `scipy.special.ndtr`, `scipy.special.ndtri`,
`scipy.special.erf`, `scipy.special.erfc`, `scipy.special.i0`,
`scipy.special.i0e`, `scipy.special.i1`, `scipy.special.i1e`,
`scipy.special.gammaln`, `scipy.special.gammainc`, `scipy.special.gammaincc`,
`scipy.special.logit`, and `scipy.special.expit`.


Implementation notes
Expand All @@ -112,25 +119,25 @@ as ``xp.concat`` (which, for numpy, maps to ``np.concatenate``). This allows
using a uniform API across NumPy, PyTorch and CuPy (as of right now; support
for other libraries like JAX is expected to be added in the future).

When the environment variable isn't set and hence Array API support in SciPy is
disabled, we still use the "augmented" version of the NumPy namespace, which is
``array_api_compat.numpy``. That should not change behavior of SciPy functions,
it's effectively the existing ``numpy`` namespace with a number of aliases
added and a handful of functions amended/added for array API standard support.
When support is enabled, depending on the type of arrays, ``xp`` will return the
standard-compatible namespace matching the input array type to a function (e.g.,
if the input to ``cluster.vq.kmeans`` is a PyTorch array, then ``xp`` is
``array_api_compat.torch``).
When the environment variable isn't set and hence array API standard support in
SciPy is disabled, we still use the "augmented" version of the NumPy namespace,
which is ``array_api_compat.numpy``. That should not change behavior of SciPy
functions, it's effectively the existing ``numpy`` namespace with a number of
aliases added and a handful of functions amended/added for array API standard
support. When support is enabled, depending on the type of arrays, ``xp`` will
return the standard-compatible namespace matching the input array type to a
function (e.g., if the input to `cluster.vq.kmeans` is a PyTorch array, then
``xp`` is ``array_api_compat.torch``).


Adding Array API support to a SciPy function
--------------------------------------------
Adding array API standard support to a SciPy function
-----------------------------------------------------

As much as possible, new code added to SciPy should try to follow as closely as
possible the Array API standard (these functions typically are best-practice
possible the array API standard (these functions typically are best-practice
idioms for NumPy usage as well). By following the standard, effectively adding
support for Array API is typically straightforward, and we ideally don't need
to maintain any customization.
support for the array API standard is typically straightforward, and we ideally
don't need to maintain any customization.

Two helper functions are available:

Expand Down
45 changes: 29 additions & 16 deletions doc/source/release/1.12.0-notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ Highlights of this release
- Experimental support for the array API standard has been added to part of
`scipy.special`, and to all of `scipy.fft` and `scipy.cluster`. There are
likely to be bugs and early feedback for usage with CuPy arrays, PyTorch
tensors, and other array API compatible libraries is appreciated.
- A new class, ``ShortTimeFFT```, provides a more versatile implementation of the
tensors, and other array API compatible libraries is appreciated. Use the
``SCIPY_ARRAY_API`` environment variable for testing.
- A new class, ``ShortTimeFFT``, provides a more versatile implementation of the
short-time Fourier transform (STFT), its inverse (ISTFT) as well as the (cross-)
spectrogram. It utilizes an improved algorithm for calculating the ISTFT.
- Several new constructors have been added for sparse arrays, and many operations
Expand Down Expand Up @@ -81,7 +82,7 @@ New features
and knot vectors. This way it generalizes ``BSpline`` for 1D data to N-D, and
parallels ``NdPPoly`` (which represents N-D tensor product polynomials).
Evaluations exploit the localized nature of b-splines.
- ``NeastNDInterpolator.__call__`` accepts ``**query_options``, which are
- ``NearestNDInterpolator.__call__`` accepts ``**query_options``, which are
passed through to the ``KDTree.query`` call to find nearest neighbors. This
allows, for instance, to limit the neighbor search distance and parallelize
the query using the ``workers`` keyword.
Expand Down Expand Up @@ -317,17 +318,19 @@ Authors
* Ben Beasley (3) +
* Doron Behar (1)
* Peter Bell (1)
* Sebastian Berg (1)
* Ben Boeckel (1) +
* Jake Bowhay (100)
* David Boetius (1) +
* Jake Bowhay (102)
* Larry Bradley (1) +
* Dietrich Brunn (5)
* Evgeni Burovski (101)
* Matthias Bussonnier (18)
* CJ Carey (4)
* CJ Carey (6)
* Colin Carroll (1) +
* Aadya Chinubhai (1) +
* Luca Citi (1)
* Lucas Colley (136) +
* Lucas Colley (140) +
* com3dian (1) +
* Anirudh Dagar (4)
* Danni (1) +
Expand All @@ -337,26 +340,28 @@ Authors
* drestebon (1) +
* Thomas Duvernay (1)
* elbarso (1) +
* emilfrost (2) +
* Paul Estano (8) +
* Evandro (2)
* Franz Király (1) +
* Nikita Furin (1) +
* gabrielthomsen (1) +
* Lukas Geiger (8) +
* Lukas Geiger (9) +
* Artem Glebov (22) +
* Caden Gobat (1)
* Ralf Gommers (120)
* Ralf Gommers (125)
* Alexander Goscinski (2) +
* Rohit Goswami (2) +
* Olivier Grisel (1)
* Matt Haberland (238)
* Matt Haberland (243)
* Charles Harris (1)
* harshilkamdar (1) +
* Alon Hovav (2) +
* Gert-Ludwig Ingold (1)
* Romain Jacob (1) +
* jcwhitehead (1) +
* Julien Jerphanion (13)
* He Jia (1)
* JohnWT (1) +
* jokasimr (1) +
* Evan W Jones (1)
Expand Down Expand Up @@ -398,12 +403,12 @@ Authors
* Roberto Pastor Muela (3) +
* Bijay Nayak (1) +
* Andrew Nelson (105)
* Praveer Nidamaluri (1) +
* Praveer Nidamaluri (2) +
* Lysandros Nikolaou (2)
* Dimitri Papadopoulos Orfanos (7)
* Pablo Rodríguez Pérez (1) +
* Dimitri Papadopoulos (2)
* Tirth Patel (13)
* Tirth Patel (14)
* Kyle Paterson (1) +
* Paul (4) +
* Yann Pellegrini (2) +
Expand All @@ -413,7 +418,7 @@ Authors
* Bharat Raghunathan (1)
* Chris Rapson (1) +
* Matteo Raso (4)
* Tyler Reddy (161)
* Tyler Reddy (165)
* Martin Reinecke (1)
* Tilo Reneau-Cardoso (1) +
* resting-dove (2) +
Expand All @@ -425,8 +430,8 @@ Authors
* Masahiro Sakai (2) +
* Omar Salman (14)
* Andrej Savikin (1) +
* Daniel Schmitz (50)
* Dan Schult (18)
* Daniel Schmitz (52)
* Dan Schult (19)
* Scott Shambaugh (9)
* Sheila-nk (2) +
* Mauro Silberberg (3) +
Expand All @@ -453,14 +458,14 @@ Authors
* Warren Weckesser (7)
* Bernhard M. Wiedemann (4)
* Levi John Wolf (1)
* Xuefeng Xu (3) +
* Xuefeng Xu (4) +
* Rory Yorke (2)
* YoussefAli1 (1) +
* Irwin Zaid (4) +
* Jinzhe Zeng (1) +
* JIMMY ZHAO (1) +

A total of 157 people contributed to this release.
A total of 161 people contributed to this release.
People with a "+" by their names contributed a patch for the first time.
This list of names is automatically generated, and may not be fully complete.

Expand Down Expand Up @@ -488,6 +493,7 @@ Issues closed for 1.12.0
* `#14480 <https://github.com/scipy/scipy/issues/14480>`__: LSODA implementation of dense output yields incorrect result
* `#15533 <https://github.com/scipy/scipy/issues/15533>`__: BUG: test failure with MKL in presence of AVX512-capable processor
* `#15676 <https://github.com/scipy/scipy/issues/15676>`__: ENH: Implement \`multivariate_normal.fit\`
* `#15738 <https://github.com/scipy/scipy/issues/15738>`__: DEP: change default of atol in \`scipy.sparse.linalg.\*\`
* `#16729 <https://github.com/scipy/scipy/issues/16729>`__: _fitpack / dfitpack duplication
* `#16880 <https://github.com/scipy/scipy/issues/16880>`__: ENH: Add Rotation.align_vector
* `#17290 <https://github.com/scipy/scipy/issues/17290>`__: ENH: multi dimensional wasserstein/earth mover distance in Scipy
Expand Down Expand Up @@ -1037,6 +1043,7 @@ Pull requests for 1.12.0
* `#19623 <https://github.com/scipy/scipy/pull/19623>`__: MAINT: lint: enable \`stacklevel\` warnings check
* `#19624 <https://github.com/scipy/scipy/pull/19624>`__: MAINT/TST: _lib: use value instead of deprecated s
* `#19626 <https://github.com/scipy/scipy/pull/19626>`__: MAINT: more SciPy windows int shims
* `#19628 <https://github.com/scipy/scipy/pull/19628>`__: DOC: 1.12.0 release notes
* `#19635 <https://github.com/scipy/scipy/pull/19635>`__: MAINT: simplify Nakagami mean calculation
* `#19637 <https://github.com/scipy/scipy/pull/19637>`__: DOC: Clarify integration error bound in \`integrate\` tutorial
* `#19648 <https://github.com/scipy/scipy/pull/19648>`__: MAINT: simplify chi distribution mean calculation
Expand All @@ -1045,3 +1052,9 @@ Pull requests for 1.12.0
* `#19658 <https://github.com/scipy/scipy/pull/19658>`__: MAINT: git blame ignores for lint clean-ups
* `#19660 <https://github.com/scipy/scipy/pull/19660>`__: STY: special: use indent width of 4 in clang-format
* `#19661 <https://github.com/scipy/scipy/pull/19661>`__: CI: fix pre-release job by correct version pin for scipy-openblas32
* `#19677 <https://github.com/scipy/scipy/pull/19677>`__: DOC: array types: mention partial support in \`special\`
* `#19686 <https://github.com/scipy/scipy/pull/19686>`__: TST: fix incorrect signal.sosfilt tests
* `#19690 <https://github.com/scipy/scipy/pull/19690>`__: BLD: avoid fast-math for oneAPI compilers, fix up handling of...
* `#19691 <https://github.com/scipy/scipy/pull/19691>`__: BUG: fix negative overflow in stats.boxcox_normmax
* `#19693 <https://github.com/scipy/scipy/pull/19693>`__: BUG: Prevent mutation of \`w\` parameter in \`spatial.distance.\*\`
* `#19702 <https://github.com/scipy/scipy/pull/19702>`__: DEP: Adopt \`\*tol\` deprecations also for \`gcrotmk/lgmres/minres/tfqmr\`
12 changes: 6 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
[build-system]
build-backend = 'mesonpy'
requires = [
"meson-python>=0.15.0",
"Cython>=0.29.35,!=3.0.3", # when updating version, also update check in meson.build
"pybind11>=2.10.4",
"pythran>=0.14.0",
"meson-python>=0.15.0,<0.16.0", # working with 0.15.x series at branch time
"Cython>=0.29.35,!=3.0.3,<3.1.0", # when updating version, also update check in meson.build
"pybind11>=2.10.4,<2.12.0", # working with 2.11.x series at branch time
"pythran@git+https://github.com/serge-sans-paille/pythran", # TODO: pin back to stable release when ready

# When numpy 2.0.0rc1 comes out, we should update this to build against 2.0,
# and then runtime depend on the range 1.22.X to <2.3. No need to switch to
Expand Down Expand Up @@ -50,11 +50,11 @@ maintainers = [
# Note: Python and NumPy upper version bounds should be set correctly in
# release branches, see:
# https://scipy.github.io/devdocs/dev/core-dev/index.html#version-ranges-for-numpy-and-other-dependencies
requires-python = ">=3.9"
requires-python = ">=3.9" # newest supported Python version: 3.12
dependencies = [
# TODO: update to "pin-compatible" once possible, see
# https://github.com/mesonbuild/meson-python/issues/29
"numpy>=1.22.4",
"numpy>=1.22.4,<1.29.0", # NOTE: at time of writing, NumPy is unlikely to go beyond 1.26.x as 2.0.0 looms
]
readme = "README.rst"
classifiers = [
Expand Down
2 changes: 1 addition & 1 deletion scipy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
from scipy._lib import _pep440
# In maintenance branch, change to np_maxversion N+3 if numpy is at N
np_minversion = '1.22.4'
np_maxversion = '9.9.99'
np_maxversion = '1.29.0'
if (_pep440.parse(__numpy_version__) < _pep440.Version(np_minversion) or
_pep440.parse(__numpy_version__) >= _pep440.Version(np_maxversion)):
import warnings
Expand Down
4 changes: 2 additions & 2 deletions scipy/optimize/_nonlin.py
Original file line number Diff line number Diff line change
Expand Up @@ -1477,10 +1477,10 @@ def matvec(self, v):
return r

def solve(self, rhs, tol=0):
if 'tol' in self.method_kw:
if 'rtol' in self.method_kw:
sol, info = self.method(self.op, rhs, **self.method_kw)
else:
sol, info = self.method(self.op, rhs, tol=tol, **self.method_kw)
sol, info = self.method(self.op, rhs, rtol=tol, **self.method_kw)
return sol

def update(self, x, f):
Expand Down

0 comments on commit 138cdbf

Please sign in to comment.