BLD: fix building against numpy dev#140
Conversation
f0da0c6 to
5250b4b
Compare
|
If I understand the upstream change correctly, there is no C API that works both in numpy 1 and numpy 2 here. In other words, my patch fixes building against numpy 2 but breaks building against numpy 1. In the long game, this isn't necessarily an issue since building against numpy 2 is supposed to be the one way to produce backward compatible artifacts, so we should soon require It should be possible (and relatively easy) to use pre-processor directives to preserve build time compat with numpy 1, so I'll try that. |
f7356d7 to
5250b4b
Compare
|
I've made a couple unsuccessful attempts at keeping build-time compat with all both versions but now I feel I don't actually understand how it's supposed to work (if at all). |
|
@seberg your input would be invaluable here 😅 |
|
You should add: since you don't want to break compiling with NumPy 1.x, but otherwise looks good. |
| if (types[i] == NPY_VOID && dtypes != NULL) { | ||
| int op_descr_type_num = op_descr->type_num; | ||
| int dtype_elsize = dtypes[i]->elsize; | ||
| int dtype_elsize = PyDataType_ELSIZE(dtypes[i]); |
There was a problem hiding this comment.
| int dtype_elsize = PyDataType_ELSIZE(dtypes[i]); | |
| npy_intp dtype_elsize = PyDataType_ELSIZE(dtypes[i]); |
Probably also still wrong in NumPy :). Not that it matters in practice, I don't think NumPy actually allows that large voids yet. Just setting the stage.
There was a problem hiding this comment.
of course ! I lost this bit while cleaning the branch, thanks for catching my mistake !
|
Thanks a lot @seberg ! |
99ae2fe to
ecae457
Compare
| "setuptools_scm>=6.2", | ||
| "jinja2>=2.10.3", | ||
| "numpy" | ||
| "numpy>=1.25", |
There was a problem hiding this comment.
I think it's now an actual requirement since my patch is using a constant that's not defined in earlier versions.
There was a problem hiding this comment.
I do think that NPY_ABI_VERSION was always defined (if it's not I should change the pattern).
FWIW, I never quite understood what is the advantage/disavantage, but overall it shouldn't matter much? For wheel builds you want it, but it's not technically a strict requirement for building. But if someone builds with --no-build-isolation it is ignored anyway...
There was a problem hiding this comment.
Happy to remove it if that's what @mhvk prefers
There was a problem hiding this comment.
Let's keep it out - I'd like to introduce a minimum version only if it is actually needed.
|
Thanks, all! Would be nice if you could trigger nightly build after merged via pyerfa/.github/workflows/publish.yml Line 7 in 7847a2f |
mhvk
left a comment
There was a problem hiding this comment.
Thanks, @neutrinoceros! This looks good and happy that the solution from @seberg works! Only, let's not set a minimum version unless it causes failures otherwise.
| "setuptools_scm>=6.2", | ||
| "jinja2>=2.10.3", | ||
| "numpy" | ||
| "numpy>=1.25", |
There was a problem hiding this comment.
Let's keep it out - I'd like to introduce a minimum version only if it is actually needed.
ecae457 to
bff2fee
Compare
|
done ! |
|
@mhvk can you re-trigger the publish workflow manually so that it actually uploads and hopefully fix astropy devdeps too ? |
Not sure I know how to do that, cc @astrofrog... (in the worst case, we make a new point release...) |
|
Please go to https://github.com/liberfa/pyerfa/actions/workflows/publish.yml and you should see an option (I don't see it here because I have no write access). It looks like this:
|
|
Once you have done that, a new entry would appear here: |
|
OK, thanks, I've done that and something is afoot! |
|
Upload step is green. Thanks! |
|
For completeness, astropy devdeps job is green again. Thanks, all! https://github.com/astropy/astropy/actions/runs/8205309742 |
|
Thanks, @neutrinoceros and @pllim! So nice if all I really have to do is to press a button (and even get explained which button to press). |

xref numpy/numpy#25943
This should fix the error seen in lastest nightly builds