Skip to content

Add support for numpy 2+#533

Open
gtrevisan wants to merge 6 commits intodevfrom
glt/numpy2
Open

Add support for numpy 2+#533
gtrevisan wants to merge 6 commits intodevfrom
glt/numpy2

Conversation

@gtrevisan
Copy link
Member

@gtrevisan gtrevisan commented Mar 23, 2026

  • unpin numpy to allow v2+,
  • lock deps to use latest numpy 2.4.3,
  • replace numpy.trapz with scipy.integrate.trapezoid,
  • check for numpy issues when importing MDSplus to avoid insecure fallback.

Note

trapz was deprecated in v2.0 and renamed to trapezoid, and eventually dropped in v2.4.

Caution

this will definitely break DIII-D workflows due to their old MDSplus version (7.139.59).
I'll push a fix -- i.e. a newer MDSplus version -- upon merge for my "public installation"...

Copy link
Contributor

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 project to be compatible with NumPy 2.x by loosening the NumPy upper bound, refreshing lockfiles to a NumPy 2.4.3 resolution, replacing deprecated numpy.trapz usage, and attempting to prevent an insecure mdsthin fallback when MDSplus fails due to NumPy-related import problems.

Changes:

  • Unpin NumPy (numpy>=1.26.0) and update lockfiles to resolve to NumPy 2.4.3.
  • Replace numpy.trapz with scipy.integrate.trapezoid in code paths that integrate signals.
  • Add logic intended to detect NumPy-related MDSplus import failures and raise instead of falling back to mdsthin.

Reviewed changes

Copilot reviewed 4 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
pyproject.toml Removes NumPy <2.0.0 upper bound to allow NumPy 2+.
poetry.lock Updates locked packages to a NumPy 2.4.3 environment (incl. netcdf4 metadata changes).
uv.lock Updates uv lock resolution to NumPy 2.4.3 and removes NumPy <2.0.0 pin.
disruption_py/settings/time_setting.py Replaces np.trapz with scipy.integrate.trapezoid.
disruption_py/machine/cmod/thomson.py Replaces np.trapz and updates SciPy import usage accordingly.
disruption_py/inout/mds.py Adds NumPy-related import failure detection to avoid mdsthin fallback.

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

@gtrevisan gtrevisan marked this pull request as ready for review March 25, 2026 15:30
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