Skip to content

Update To NumPy 2.0 And SciPy 1.12#23

Open
marcpaterno wants to merge 3 commits intojablazek:masterfrom
marcpaterno:master
Open

Update To NumPy 2.0 And SciPy 1.12#23
marcpaterno wants to merge 3 commits intojablazek:masterfrom
marcpaterno:master

Conversation

@marcpaterno
Copy link

The use of numpy.trapz, which is removed in numpy v2.4 (it has been deprecated since v2.0).

Replace deprecated np.trapz with np.trapezoid in FASTPT.py and FASTPT_simple.py to maintain compatibility with NumPy 2.0. Update minimum version requirements for numpy (2.0) and scipy (1.12) in requirements.txt.
Remove commented import from matter_power_spt.py.

Replace deprecated np.trapz with np.trapezoid in
FASTPT.py and FASTPT_simple.py to maintain
compatibility with NumPy 2.0. Update minimum
version requirements for numpy (2.0) and scipy
(1.12) in requirements.txt. Remove commented
import from matter_power_spt.py.
Copilot AI review requested due to automatic review settings January 7, 2026 18:53
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the codebase to be compatible with NumPy 2.0 by replacing the deprecated np.trapz function with np.trapezoid. The minimum version requirements are updated to numpy>=2.0 and scipy>=1.12 to ensure compatibility.

  • Replaced all occurrences of np.trapz with np.trapezoid in FASTPT.py and FASTPT_simple.py
  • Updated minimum version requirements for numpy (1.17 → 2.0) and scipy (1.2 → 1.12)
  • Removed unused commented import statement

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated no comments.

File Description
requirements.txt Updated minimum versions for numpy (2.0) and scipy (1.12)
fastpt/utils/matter_power_spt.py Removed unused commented import of scipy.integrate.trapz
fastpt/core/FASTPT_simple.py Replaced np.trapz with np.trapezoid in P_bias method
fastpt/core/FASTPT.py Replaced np.trapz with np.trapezoid in _get_sig4 method

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@marcpaterno
Copy link
Author

The CI seems to be failing for Python 3.13 because the build (after downloading numpy 2.4.1) then proceeds to use numpy 1.26.4, which does not work. Because the Scientific Python Ecosystem Coordination group no longer supports this old version, I would suggest the best solution is to update the build to reflect the versions they support (see https://scientific-python.org/specs/spec-0000/).

I could also modify the PR to try to keep compatibility with the old versions, but this collides exactly with the issues described in the Motivation section of the Spec 0 proposal, linked above.

Please let me know what you'd like me to do.

Raise minimum Python requirement from 3.7 to 3.9 to align
with modern package support and demands of numpy. Update
dependency minima to follow SPEC 0:
numpy to 2.0, scipy to 1.13, and matplotlib to 3.9.

Remove obsolete numpy version constraint from CI workflow
and delete outdated compatibility note from README about
numpy 1.24 issues in earlier package versions.
Add Ubuntu to the OS matrix alongside macOS to test on
multiple platforms. Add Python 3.14 to the version matrix.
Update GitHub Actions to latest versions (checkout v3→v4,
setup-python v4→v5).
@marcpaterno
Copy link
Author

I have updated some elements of the build and CI to better match current best practice.
I'd be happy to discuss this PR if that would be useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants