Skip to content

API: align default value for copy arguments with numpy at runtime (warn about copy=False)#16174

Closed
neutrinoceros wants to merge 3 commits into
astropy:mainfrom
neutrinoceros:api/copy_if_needed
Closed

API: align default value for copy arguments with numpy at runtime (warn about copy=False)#16174
neutrinoceros wants to merge 3 commits into
astropy:mainfrom
neutrinoceros:api/copy_if_needed

Conversation

@neutrinoceros

@neutrinoceros neutrinoceros commented Mar 7, 2024

Copy link
Copy Markdown
Contributor

Description

This is based off #16166 and #16170 and adds a minor but crucial API change to align the default value of our copy arguments with whatever numpy API is installed. See #16167 for the broader context.

Passing copy=False is still supported but raises a warning.
Alternative: #16181

This is meant to be a small self-contained PR that we can ask downstream stakeholders to test from, but this will only make sense once #16166 and #16170 are merged. At that point, I'll call for feedback on the dev mailing list.

  • By checking this box, the PR author has requested that maintainers do NOT use the "Squash and Merge" button. Maintainers should respect this when possible; however, the final decision is at the discretion of the maintainer that merges the PR.

@github-actions

github-actions Bot commented Mar 7, 2024

Copy link
Copy Markdown
Contributor

Thank you for your contribution to Astropy! 🌌 This checklist is meant to remind the package maintainers who will review this pull request of some common things to look for.

  • Do the proposed changes actually accomplish desired goals?
  • Do the proposed changes follow the Astropy coding guidelines?
  • Are tests added/updated as required? If so, do they follow the Astropy testing guidelines?
  • Are docs added/updated as required? If so, do they follow the Astropy documentation guidelines?
  • Is rebase and/or squash necessary? If so, please provide the author with appropriate instructions. Also see instructions for rebase and squash.
  • Did the CI pass? If no, are the failures related? If you need to run daily and weekly cron jobs as part of the PR, please apply the "Extra CI" label. Codestyle issues can be fixed by the bot.
  • Is a change log needed? If yes, did the change log check pass? If no, add the "no-changelog-entry-needed" label. If this is a manual backport, use the "skip-changelog-checks" label unless special changelog handling is necessary.
  • Is this a big PR that makes a "What's new?" entry worthwhile and if so, is (1) a "what's new" entry included in this PR and (2) the "whatsnew-needed" label applied?
  • At the time of adding the milestone, if the milestone set requires a backport to release branch(es), apply the appropriate "backport-X.Y.x" label(s) before merge.

@github-actions

github-actions Bot commented Mar 7, 2024

Copy link
Copy Markdown
Contributor

👋 Thank you for your draft pull request! Do you know that you can use [ci skip] or [skip ci] in your commit messages to skip running continuous integration tests until you are ready?

@pllim pllim added this to the v6.1.0 milestone Mar 7, 2024
@neutrinoceros neutrinoceros changed the title API: align default value for copy arguments with numpy at runtime API: align default value for copy arguments with numpy at runtime (warn about copy=False) Mar 8, 2024
@neutrinoceros neutrinoceros force-pushed the api/copy_if_needed branch 3 times, most recently from 08e6a8c to 9a08830 Compare March 10, 2024 22:01
@neutrinoceros

Copy link
Copy Markdown
Contributor Author

Turns out, this path puts pressure on yet more parts of the code base to switch from copy=False to copy=COPY_IF_NEEDED just so they can dodge the warning, but the existence of #16181 shows that copy=False is perfectly fine in these places even in numpy 2. Therefore, I'm not sure this alternative is worth pursuing.

I'll still take a minute to try and fix it completely, just to see exactly how bad it is, but I need to iterate locally, and right now, I'm having issues building against the latest numpy dev locally.

@neutrinoceros

neutrinoceros commented Mar 11, 2024

Copy link
Copy Markdown
Contributor Author

It took me longer than I care to admit but I fixed almost everything locally... which results in a patch that's several times the size of #16166 and has the undesirable effect of effectively prohibiting copy=False inside the code base, which in itself also seems like a net negative to me, in particular because it indicates that the API is actually less flexible and more brittle if we go this path.

My personal preference is now strongly towards #16181

@neutrinoceros

Copy link
Copy Markdown
Contributor Author

There seem to be a consensus for going with #16181, so even if it's not merged yet, I think we can close this one now.

@neutrinoceros neutrinoceros deleted the api/copy_if_needed branch April 3, 2024 13:10
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.

2 participants