Repository navigation
RFC: refactor copy argument sanitizing into a unified compat function - #16170
Conversation
|
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.
|
da04070 to
bbb4391
Compare
|
|
||
| def sanitize_copy_arg(copy, /): | ||
| if not NUMPY_LT_2_0 and copy is False: | ||
| # TODO: deprecate this path, and eventually remove this entire function |
There was a problem hiding this comment.
this TODO could be updated or removed. It isn't needed for this PR, and largely depends on future conversation in #16167
There was a problem hiding this comment.
(I removed it)
bbb4391 to
428d39c
Compare
pllim
left a comment
There was a problem hiding this comment.
I thought we agreed to just follow numpy 2.x convention if people have numpy 2.x, and if people want the old numpy 1.x behavior, they should just downgrade numpy back to 1.x. With that in mind, this PR is completely unnecessary?
|
This PR is actually older than the discussion, but I think it still has value in that it prevents that some paths are updated and not others. I could just remove or update the TODO comment to avoid making promises on the future. |
|
Is this still needed? The conclusion to just live with whatever numpy does suggests that all we need to do is update any |
|
That was indeed a clear consensus amongst participants in the last dev telecon, however we also agreed that we should ultimately involve downstream stake holders and give them a chance to test different approaches so we can settle for the most aggressive one that doesn't cause too much immediate pain. With this in mind, there are two alternative continuations to this PR:
the second one just removes the function I'm introducing here, but the first one creates a deprecation path instead. So, if it turns out downstream players are not affected by the API change, we'll indeed just end up removing this function. However, given the uncertainty, I believe there is still value in having one source of truth instead of multiple instances of this code bits. |
mhvk
left a comment
There was a problem hiding this comment.
Ah, I see, I missed that c a deprecation warning would indeed much more easily raised inside a function. Since you're all set up to do this, and we will either end up removing this or adding a deprecation warning, I think this is good to go. Thanks, @neutrinoceros!
|
p.s. Not sure what's up with the tests that just seem to be waiting to be run. |
|
I think that's a side effect of merging #15603. If it's blocking I can rebase this one. |
|
I cannot override the statuses, so, yes, maybe best to rebase so we can actually merge... |
428d39c to
519536e
Compare
|
done |
|
Oh, actually blocked by scientific-python/pytest-doctestplus#242 |
|
closing/reopening to retrigger CI now that pytest-doctestplus was updated |
519536e to
f5071ab
Compare
f5071ab to
805b16b
Compare
|
OK, thanks, let's get this in so the other two can be rebased... |
|
Thanks Marten ! every child branches is now rebased and conflict-free |
Description
This is a follow up to #16142 so we have a single source of truth regarding how we treat user-provided
copy=Falsearguments.This is also a step forward followin my proposed long term plan (see #16167), but it's in itself not an API cchange and could be backported for convenience if desired.