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

MAINT: Fix for NumPy 2.0 #1303

Closed
wants to merge 1 commit into from
Closed

MAINT: Fix for NumPy 2.0 #1303

wants to merge 1 commit into from

Conversation

larsoner
Copy link
Contributor

@larsoner larsoner commented Mar 4, 2024

Might fix https://github.com/mne-tools/mne-python/actions/runs/8127208745/job/22227091689?pr=12478#step:17:365 :

mne/_freesurfer.py:144: in _get_mri_info_data
    out["data"] = np.array(mgz.dataobj)
E   TypeError: ArrayProxy.__array__() got an unexpected keyword argument 'copy'

This was in MNE-Python with a MGZ file, but I imagine many tests using scientific-python-nightly-wheels in nibabel will fail similarly without this. @effigies or others feel free to close this or push directly if other changes are needed if it's easier than commenting!

Copy link

codecov bot commented Mar 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.17%. Comparing base (e4facc1) to head (11cf547).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1303      +/-   ##
==========================================
- Coverage   92.27%   92.17%   -0.10%     
==========================================
  Files          99       99              
  Lines       12460    12460              
  Branches     2561     2561              
==========================================
- Hits        11497    11485      -12     
- Misses        641      648       +7     
- Partials      322      327       +5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@effigies
Copy link
Member

effigies commented Mar 4, 2024

This looks painful. np.array(copy=False)-equivalent behavior is being changed to np.array(copy=None) in 2.0 with no deprecation period.

Also, the type checking for the updated types will only work if mypy and numpy 2.0-dev are installed into the same environment. I think we're going to need to see if we can drop our custom ArrayLike protocol and use numpy's directly. I can't immediately see another way to work with types that differ between stable and dev versions.

@larsoner
Copy link
Contributor Author

larsoner commented Mar 4, 2024

😨

Okay I'll leave that to another PR then! Hopefully it ends up being less painful than it sounds

@larsoner larsoner closed this Mar 4, 2024
@larsoner larsoner deleted the np branch March 4, 2024 15:02
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