ABI: Bump C-ABI to 2 but accept older NumPy if compiled against new one#23916
ABI: Bump C-ABI to 2 but accept older NumPy if compiled against new one#23916mattip merged 5 commits intonumpy:mainfrom
Conversation
As of now we can do this, because only _removing_ features we will remain truly ABI compatible. NEP 53 outlines a plan to introduce `numpy2_compat` which would allow more extensive changes, but lets start with this much simpler one.
Since we force users to compile against NumPy 2.0 (if they wish to support NumPy 2.0+), it is OK to remove things from the API Table. Allow doing so! (note that NEP 53 suggests introducing `numpy2_compat`. This would allow fully replacing the table, for now, lets see how far we can get without it though!
|
Hmmmmm, bumping the ABI version works. But the docs fail to import matplotlib... We could just not bump it for now? Or even bump it, but let |
This is a hack, but before the actual release process it allows us to use downstream libs (so long there isn't an actual ABI problem, but I don't expect one for a while).
| * allows (for the moment) downstream modules to mix and match | ||
| * and us to import old matplotlib versions in our doc builds... | ||
| */ | ||
| return (unsigned int)0x01000009; |
There was a problem hiding this comment.
Since I put it at the wrong place first:
This is clearly an evil hack. I think I am leaning towards doing it though (with an issue opened of course!). It cannot be in a final release of course, and we could escalate to requiring an env variable soon.
Now, of course there is a good chance this will break down earlier anyway, because we will have enough reason to create that numpy2_compat package (meaning the de-facto ABI compatibility breaks down).
@mattip and @rgommers what do you think? Or is this too piece-meal for you?
There was a problem hiding this comment.
I am perfectly fine with such piecemeal tweaks to get to the desired end state. I think we can expect the C ABI to break multiple times during the 2.0 journey, and it's okay to lie a bit or do whatever is pragmatic to keep our CI or nightlies in a functional state during this period.
|
Thanks @seberg |
|
I guess we will find out soon enough if this breaks downstream, so let's do it. |
This commits bumps the C-ABI version but allows compiling against older NumPy versions (the previous bump was 13 years ago, I am ignoring it).
The second commit adds
__unused_indices__as a special entry in the API Table generation (I didn't have a better idea), and patches things up to allow holes in the API table.The last commit adds a couple of those holes by removing functions that were long "disabled".
I was first thinking to remove
PyArray_Dump(s), but then realized that should probably includearr.dump(s)andscalar.dump(s). So, lets start with some things that can clearly beemptysimply deleted.In NEP 53, I suggested creating
numpy2_compat, that would allow a few additional things. I suspect we should go there, but this will carry us to some of the most important changes easily, so lets start with it.