From 8c87ed6e7aac35c901d3290015745993147d7831 Mon Sep 17 00:00:00 2001 From: "Adam J. Jackson" Date: Wed, 24 Jul 2024 10:22:53 +0100 Subject: [PATCH] Bump numpy requirement to 1.24, matching Mantid (#309) * Bump numpy requirement to 1.24, matching Mantid While transitioning to Numpy 2.0 it is helpful to reduce the range of versions being used and tested. As we are changing other requirements in this release, it is a good time to bump Numpy. Here we also update the build/release workflow to add Python 3.12 and build with Numpy 2.0; these builds _should_ also work with all the supported numpy 1.x. * Bump threadpoolctl requirement to 3.0 "Min requirements" tests were throwing up some warnings suggesting that the openblas API wasn't being accessed succesfully. This seems to be resolved in version 3 and there are no knock-on effects to other dependencies. --- .github/workflows/build_upload_pypi_wheels.yml | 17 +++++++++-------- CHANGELOG.rst | 12 +++++++----- setup.py | 5 +++-- .../minimum_euphonic_requirements.txt | 4 ++-- tox.ini | 3 ++- 5 files changed, 23 insertions(+), 18 deletions(-) diff --git a/.github/workflows/build_upload_pypi_wheels.yml b/.github/workflows/build_upload_pypi_wheels.yml index d7c08a0da..70163c2c4 100644 --- a/.github/workflows/build_upload_pypi_wheels.yml +++ b/.github/workflows/build_upload_pypi_wheels.yml @@ -9,22 +9,23 @@ jobs: build: strategy: matrix: - os: [windows-latest, macos-13, ubuntu-latest] - python-version: ['3.10', '3.11'] + os: [windows-latest, macos-13, macos-latest, ubuntu-latest] + python-version: ['3.10', '3.11', '3.12'] include: - os: windows-latest wheelname: win - os: macos-13 - wheelname: macos + wheelname: macos-intel + - os: macos-latest + wheelname: macos-arm - os: ubuntu-latest wheelname: manylinux - # Build wheels against the lowest compatible Numpy version - python-version: '3.10' manylinux-version-tag: cp310 - numpy-version: 1.21.3 - python-version: '3.11' manylinux-version-tag: cp311 - numpy-version: 1.23.2 + - python-version: '3.11' + manylinux-version-tag: cp311 fail-fast: false runs-on: ${{ matrix.os }} steps: @@ -50,7 +51,7 @@ jobs: if: matrix.os != 'ubuntu-latest' shell: bash -l {0} env: - NUMPY_VERSION: ${{ matrix.numpy-version }} + NUMPY_VERSION: 2.0 run: | # Build against lowest required Numpy version python -m pip install numpy==${NUMPY_VERSION} @@ -61,7 +62,7 @@ jobs: uses: pypa/cibuildwheel@v2.12.0 env: CIBW_BUILD: ${{ matrix.manylinux-version-tag}}-manylinux* - CIBW_BEFORE_BUILD: python -mpip install numpy==${{ matrix.numpy-version }} + CIBW_BEFORE_BUILD: python -mpip install numpy==2.0 CIBW_ARCHS: x86_64 with: output-dir: wheelhouse diff --git a/CHANGELOG.rst b/CHANGELOG.rst index afbb54649..7865f58fd 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -7,12 +7,12 @@ - Python 3.12 is supported - - Python 3.10+ requires numpy >= 1.21.3 - - importlib_resources backport is no longer required - - Some other dependency requirements have been increased because - older versions are difficult to test against Python 3.10: + - Some other dependency requirements have been increased in order + to simplify maintenance and testing: + + - Minimum version of numpy increased from 1.19.3 to 1.24.0 - Minimum version of matplotlib increased from 3.2 to 3.8 @@ -20,7 +20,9 @@ - Minimum version of PyYAML increased from 3.13 to 6.0 - - Minimum version of h5py increaased form 2.10 to 3.6 + - Minimum version of h5py increaased from 2.10 to 3.6 + + - Minimum version of threadpoolctl increased from 1.0 to 3.0. - Big fixes diff --git a/setup.py b/setup.py index 0b2cf2df1..c7b9250cb 100644 --- a/setup.py +++ b/setup.py @@ -139,11 +139,12 @@ def run_setup(): include_package_data=True, install_requires=[ 'packaging', - 'scipy>=1.10', # requires numpy >= 1.19.5; py3.10 requires 1.21.3 + 'numpy>=1.24.0', + 'scipy>=1.10', 'seekpath>=1.1.0', 'spglib>=1.9.4', 'pint>=0.22', - 'threadpoolctl>=1.0.0' + 'threadpoolctl>=3.0.0' ], extras_require={ 'matplotlib': ['matplotlib>=3.8.0'], diff --git a/tests_and_analysis/minimum_euphonic_requirements.txt b/tests_and_analysis/minimum_euphonic_requirements.txt index d7ba1efd8..065a89b61 100644 --- a/tests_and_analysis/minimum_euphonic_requirements.txt +++ b/tests_and_analysis/minimum_euphonic_requirements.txt @@ -1,4 +1,4 @@ -numpy==1.21.3 +numpy==1.24.0 scipy==1.10.0 spglib==1.9.4.2 seekpath==1.1.0 @@ -6,4 +6,4 @@ pint==0.22 matplotlib==3.8 h5py==3.6 PyYAML==6.0 -threadpoolctl==1.0.0 +threadpoolctl==3.0.0 diff --git a/tox.ini b/tox.ini index 4b36e2afc..4c8aeba76 100644 --- a/tox.ini +++ b/tox.ini @@ -91,7 +91,8 @@ install_command = platform = linux: linux deps = - numpy==1.21.3 + numpy==1.24.0 + {[testenv:py310]deps} commands_pre = python -m pip install --force-reinstall \ -r{toxinidir}/tests_and_analysis/minimum_euphonic_requirements.txt