Skip to content

Adopt the array api #885

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

Open
wants to merge 111 commits into
base: main
Choose a base branch
from
Open

Adopt the array api #885

wants to merge 111 commits into from

Conversation

mwcraig
Copy link
Member

@mwcraig mwcraig commented Mar 19, 2025

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
Copy link

codecov bot commented Mar 20, 2025

Codecov Report

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

Files with missing lines Patch % Lines
ccdproc/_ccddata_wrapper_for_array_api.py 86.95% 15 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        ?   97.06%           
=======================================
  Files           ?        8           
  Lines           ?     1531           
  Branches        ?        0           
=======================================
  Hits            ?     1486           
  Misses          ?       45           
  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
Copilot

This comment was marked as outdated.

@eteq
Copy link
Member

eteq commented Jun 24, 2025

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)

@@ -8,17 +8,19 @@ dynamic = ["version"]
description = "Astropy affiliated package"
readme = "README.rst"
license = { text = "BSD-3-Clause" }
requires-python = ">=3.8"
requires-python = ">=3.11"
Copy link
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
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
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
Member

Choose a reason for hiding this comment

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

Copy link
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
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

@@ -8,17 +8,19 @@ dynamic = ["version"]
description = "Astropy affiliated package"
readme = "README.rst"
license = { text = "BSD-3-Clause" }
requires-python = ">=3.8"
requires-python = ">=3.11"
Copy link
Member

Choose a reason for hiding this comment

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

@mwcraig mwcraig force-pushed the explore-array-api branch 3 times, most recently from 2fa76b7 to 3b2b9fc Compare July 3, 2025 18:28
mwcraig and others added 2 commits July 31, 2025 09:23
Co-authored-by: Nathaniel Starkman <nstarman@users.noreply.github.com>
@mwcraig
Copy link
Member Author

mwcraig commented Jul 31, 2025

@nstarman -- thanks again for the thorough review! Can you please give this comment a thumbs-up if you think this is ready for merge?

@mwcraig mwcraig force-pushed the explore-array-api branch from 5c81f63 to 2a877a9 Compare August 18, 2025 14:24
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.

3 participants