Skip to content

Compatibility with numpy 2.5#716

Closed
pllim wants to merge 1 commit into
spacetelescope:mainfrom
pllim:numpydev-dtype
Closed

Compatibility with numpy 2.5#716
pllim wants to merge 1 commit into
spacetelescope:mainfrom
pllim:numpydev-dtype

Conversation

@pllim
Copy link
Copy Markdown
Collaborator

@pllim pllim commented Apr 27, 2026

This PR addresses deprecation warning seen in jwst devdeps, as reported by Melanie Clarke.

Tasks

news fragment change types...
  • changes/<PR#>.feature.rst: new feature
  • changes/<PR#>.bugfix.rst: fixes an issue
  • changes/<PR#>.doc.rst: documentation change
  • changes/<PR#>.removal.rst: deprecation or removal of public API
  • changes/<PR#>.misc.rst: infrastructure or miscellaneous change

@pllim pllim added no-changelog-entry-needed Trivial change that doesn't need an entry in the change log run extra tests labels Apr 27, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 27, 2026

Codecov Report

❌ Patch coverage is 80.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 90.36%. Comparing base (758be1c) to head (0e3461b).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/stdatamodels/util.py 80.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #716      +/-   ##
==========================================
- Coverage   90.37%   90.36%   -0.02%     
==========================================
  Files          99       99              
  Lines        4582     4586       +4     
==========================================
+ Hits         4141     4144       +3     
- Misses        441      442       +1     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@pllim
Copy link
Copy Markdown
Collaborator Author

pllim commented Apr 27, 2026

CI failures from test_schema_against_crds.py are not related and also seen in an unrelated PR over at #717

but unfortunately it does block the testing of this fix here.

@pllim pllim marked this pull request as ready for review April 27, 2026 19:26
@pllim pllim requested a review from a team as a code owner April 27, 2026 19:26
Copy link
Copy Markdown
Collaborator

@braingram braingram left a comment

Choose a reason for hiding this comment

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

The warning suggests making a view. Can we use that approach here?

Comment thread src/stdatamodels/util.py
if NUMPY_LT_2_5:
a.dtype = _rebuild_fits_rec_dtype(a)
else:
np.ndarray._set_dtype(a, _rebuild_fits_rec_dtype(a))
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Let's find a way that doesn't involve a private undocumented numpy method.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This patch is copied from astropy , see astropy/astropy#19584 . The author of that PR is a developer of both astropy and numpy, so if he cannot find a way, I doubt we can.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This fix is consistent with how astropy addressed it:
https://github.com/astropy/astropy/pull/19584/changes

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

If you want a proper investigation, I can close this PR and open a JIRA ticket instead.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

#718 fixes the incompatibility by removing the dtype setting.

@melanieclarke
Copy link
Copy Markdown
Contributor

Remaining diffs from the devdeps are as expected, for upcoming changes in photutils and numpy/scipy.

@pllim pllim closed this Apr 28, 2026
@pllim pllim deleted the numpydev-dtype branch April 28, 2026 13:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-changelog-entry-needed Trivial change that doesn't need an entry in the change log run extra tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants