Skip to content

Adopt the array api#885

Merged
mwcraig merged 112 commits into
astropy:mainfrom
mwcraig:explore-array-api
Sep 4, 2025
Merged

Adopt the array api#885
mwcraig merged 112 commits into
astropy:mainfrom
mwcraig:explore-array-api

Conversation

@mwcraig

@mwcraig mwcraig commented Mar 19, 2025

Copy link
Copy Markdown
Member

This PR makes the necessary changes to adopt the array API. There are still some things to sort out:

  • Run tests mostly against numpy, but do one run against jax (or some other non-numpy array library)
  • Check for remaining invocations of numpy in the code.
  • Check whether changing .data_arr.mask to .data_arr_mask constitutes an API change. If it does (and I think it does) then patch things up so that .data_arr.mask points to .data_arr_mask
  • Clean up any remaining handling of immutable arrays (array_api_extra makes handling those easy)

Once those are done the next step will be to find an outside reviewer for this...

@mwcraig mwcraig added this to the 2.5.0 milestone Mar 19, 2025
@codecov

codecov Bot commented Mar 20, 2025

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.10569% with 29 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (main@5aa9219). Learn more about missing BASE report.
⚠️ Report is 134 commits behind head on main.

Files with missing lines Patch % Lines
ccdproc/_ccddata_wrapper_for_array_api.py 84.51% 24 Missing ⚠️
ccdproc/core.py 98.25% 3 Missing ⚠️
ccdproc/image_collection.py 92.30% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #885   +/-   ##
=======================================
  Coverage        ?   96.56%           
=======================================
  Files           ?        8           
  Lines           ?     1571           
  Branches        ?        0           
=======================================
  Hits            ?     1517           
  Misses          ?       54           
  Partials        ?        0           

☔ 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.

@mwcraig mwcraig force-pushed the explore-array-api branch from 85625f0 to 04293b7 Compare March 27, 2025 18:05
@mwcraig mwcraig marked this pull request as ready for review June 24, 2025 14:55
@mwcraig mwcraig changed the title WIP: Adopt the array api Adopt the array api Jun 24, 2025
@mwcraig mwcraig requested a review from Copilot June 24, 2025 16:42

This comment was marked as outdated.

@eteq

eteq commented Jun 24, 2025

Copy link
Copy Markdown
Member

As a quick FYI I ran the test suite in this PR on a machine with a NVidia GPU with CCDPROC_ARRAY_LIBRARY=cupy and got a whole pile of errors (sent the log directly to @mwcraig but can also share snippets here if someone else wants to see them)

Comment thread pyproject.toml
Comment thread ccdproc/combiner.py
Comment thread ccdproc/combiner.py Outdated
Comment thread pyproject.toml
readme = "README.rst"
license = { text = "BSD-3-Clause" }
requires-python = ">=3.8"
requires-python = ">=3.11"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Adopt Spec 0? Has that been adopted?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Good catch!

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Wait, misread this -- what is Spectrum 0?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

So the move here would be to bump it up to 3.12?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

3.11 for a few more months. Then 3.12. I was also thinking about adding the badge saying "Spec 0", e.g. you can see in the README in https://github.com/GalacticDynamics/unxt

Comment thread pyproject.toml Outdated
Comment thread ccdproc/combiner.py Outdated
Comment thread pyproject.toml
readme = "README.rst"
license = { text = "BSD-3-Clause" }
requires-python = ">=3.8"
requires-python = ">=3.11"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Comment thread ccdproc/core.py Outdated
Comment thread pyproject.toml
@mwcraig mwcraig force-pushed the explore-array-api branch 3 times, most recently from 2fa76b7 to 3b2b9fc Compare July 3, 2025 18:28
@mwcraig mwcraig force-pushed the explore-array-api branch from 5c81f63 to 2a877a9 Compare August 18, 2025 14:24
@mwcraig mwcraig force-pushed the explore-array-api branch from 91b1118 to e2a808f Compare August 29, 2025 14:22
@mwcraig mwcraig mentioned this pull request Sep 4, 2025
@mwcraig mwcraig merged commit 22ab5ca into astropy:main Sep 4, 2025
15 checks passed
@mwcraig mwcraig deleted the explore-array-api branch September 4, 2025 18:35
@nstarman

nstarman commented Sep 4, 2025

Copy link
Copy Markdown
Member

🎉

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants