BLD: enable building NumPy with Meson#22663
Conversation
025d655 to
b3b864e
Compare
|
The phase |
The "build" label does that. |
argh, the #!@&$ bot defeating my labeling. thanks for pointing that out. |
52107a1 to
3f0c588
Compare
|
When trying to compile on windows, I get different outputs from distutils and meson. _numpyconfig.h generated by distutils_numpyconfig.h generated by mesonIt looks like a bunch of headers are not linked correctly - I am very ignorant on windows issues but just as an experiment I edited |
|
Thanks @melissawm, that doesn't look too bad. The C99 complex types indeed aren't available, the headers are consistent there. A difference is that it's explicit in the meson-generated headers (shows as I'll make the MSVC version change you pointed out, and will open a separate issue for Windows support as a follow-up to this PR. |
51c8ab5 to
5dbac25
Compare
`Python.h` must be included before including and standard library
headers, if it's pulled in (which happens when you include numpy
headers). Otherwise we see build warnings like:
```
142/244] Compiling C object numpy/core/_multiarray_umath.cpython-311-x86_64-linux-gnu.so.p/src_multiarray_textreading_field_types.c.o
In file included from /opt/hostedtoolcache/Python/3.11.0/x64/include/python3.11/Python.h:86,
from ../numpy/core/include/numpy/npy_common.h:5,
from ../numpy/core/include/numpy/ndarraytypes.h:4,
from ../numpy/core/src/multiarray/textreading/field_types.h:9,
from ../numpy/core/src/multiarray/textreading/field_types.c:1:
/opt/hostedtoolcache/Python/3.11.0/x64/include/python3.11/cpython/pytime.h:208:60: warning: ‘struct timespec’ declared inside parameter list will not be visible outside of this definition or declaration
208 | PyAPI_FUNC(int) _PyTime_FromTimespec(_PyTime_t *tp, struct timespec *ts);
| ^~~~~~~~
/opt/hostedtoolcache/Python/3.11.0/x64/include/python3.11/cpython/pytime.h:213:56: warning: ‘struct timespec’ declared inside parameter list will not be visible outside of this definition or declaration
213 | PyAPI_FUNC(int) _PyTime_AsTimespec(_PyTime_t t, struct timespec *ts);
| ^~~~~~~~
/opt/hostedtoolcache/Python/3.11.0/x64/include/python3.11/cpython/pytime.h:217:63: warning: ‘struct timespec’ declared inside parameter list will not be visible outside of this definition or declaration
217 | PyAPI_FUNC(void) _PyTime_AsTimespec_clamp(_PyTime_t t, struct timespec *ts);
| ^~~~~~~~
```
This enables building with NumPy on Linux and macOS. Windows support should be complete to, but is untested as of now and may need a few tweaks. This contains: - A set of `meson.build` files and related code generation script tweaks, header templates, etc. - One CI job on Linux - Basic docs on using Meson to build NumPy (not yet integrated in the html docs, it's too early for that - this is for early adopters right now). The build should be complete, with the major exception of SIMD support. The full test suite passes. See numpygh-22546 for the tracking issue with detailed notes on the plan for switching NumPy to Meson as its build system. Co-authored-by: Stefan van der Walt <stefanv@berkeley.edu>
5dbac25 to
4002a7d
Compare
|
The labeler bot is messing with labels again. It should never do that after the initial run it had, this is both annoying and a huge waste of CI resources. I believe the SciPy action gets this right (we removed it once until this exact issue was fixed). Can I interest anyone in fixing that? EDIT: I have manually disabled it via the GitHub UI for the time being. |
|
Okay, this is ready to go in. I'll also point out that this adds |
|
Okay, I'll hit the green button and will then update the |
|
Not quite sure if it is this, but locally, I am now getting: when using |
|
check what version of setuptools you have. We pin to setuptools<60 for a reason |
|
Ugh. No support for PEP 621 probably. What
That is because that does an isolated build, so pinned |
Indeed, but we can comment out these |
| license-files.paths = [ | ||
| "LICENSE.txt", | ||
| "LICENSES_bundles.txt" | ||
| ] |
There was a problem hiding this comment.
Unsupported versions of setuptools that are NOT version 59 as pinned in this file, add pyproject.toml support to begin with -- and don't like this PEP 639 draft metadata key because reasons.
There was a problem hiding this comment.
Basically, apparently it's setuptools' job (even if setuptools is supposed to use setup.py) to refuse to build anything at all, if a new informational metadata value is added to the standard and setuptools doesn't support it.
I guess that's sort of defensible. The spec says:
When specifying project metadata, tools MUST adhere and honour the metadata as specified in this PEP. If metadata is improperly specified then tools MUST raise an error to notify the user about their mistake.
@abravalheri was presumably relying on that wording when implementing setuptools' hard error mode there?
There was a problem hiding this comment.
Hi @eli-schwartz , if setuptools is invoked in a project that contains pyproject.toml it will try to read metadata/configuration from it.
It also will try to follow the spec as close as possible.
There was a problem hiding this comment.
Thanks for the explanations. I'll open a PR to comment out the problematic items.
Side note: it'd be great if PEP 639 was hurried along, it's quite annoying that PyPI doesn't properly support PEP 621 license info (mainly because it's not sufficient, bad spec), and is waiting for PEP 639 to get something sensible implemented. Right now are choices are basically to ignore any spec and do whatever setuptools does, or to get the mess that you see in the sidebar of https://pypi.org/project/scipy/. Context in mesonbuild/meson-python#129.
|
I got a too new setuptools indeed, although I guess it is a mix of things since it worked before? Anyway, I am happy if/that the answer is to make sure the setuptools pin adds up again. (I guess the hard error mode may be weird, but a setuptools thing to worry about) |
This enables building with NumPy on Linux and macOS. Windows support should be complete too, but is untested as of now and may need a few tweaks. This contains:
meson.buildfiles and related code generation script tweaks, header templates, etc.The build should be complete, with the major exception of SIMD support. The full test suite passes. See gh-22546 for the tracking issue with detailed notes on the plan for switching NumPy to Meson as its build system.