mesonbuild / meson-python

Meson PEP 517 Python build backend
https://mesonbuild.com/meson-python/
MIT License
123 stars 65 forks source link

Document meson-python requirements on how `import('python').find_installation()` is called #233

Open dnicolodi opened 1 year ago

dnicolodi commented 1 year ago

meson-python invokes meson and meson may be run by a different Python interpreter than the one used to run meson-python via pip or build or other pep517 frontend. meson-python uses a native file to pass the python interpreter to build for to meson. AFAIK, this works only if a path to a Python interpreter is not explicitly passed as an argument to import('python').find_installation(). This should be documented.

kif commented 1 year ago

+1: I was debugging an issue with multiple interpreter (python 3.10 + 3.11) on a "remote" architecture (i386 chroot on amd64 or armv7 on aarm64) outside of any virtual-env (for debian packaging) thus specifying the interpreter is very important to me. Having it documented is equally important.

dnicolodi commented 1 year ago

What issue did you encounter? meson-python works in the same way as other Python build tools work: the extensions are built for the interpreter running the build process.

kif commented 1 year ago

I think debian is part of the problem since they did not yet move completely away from calling setup.py. The DD in charge of my packages (@picca) asked me to keep the distutils part for the year to come to be able to continue packaging them. Debian did neither package scipy 1.9.

That said, I don't think illogical to have a way to say python=/usr/bin/pyhton310 or python=/usr/bin/python311. The same way I encountered a similar bug with cython not found since on debian, cython refers to the cython for python2 and one has to call cython3. Once again those are remarks for the documentation when packaging in the PEP517 spirit, and probably not bugs specific to meson-python.

rgommers commented 1 year ago

Debian did neither package scipy 1.9.

That was not because they can't use any other build system I believe. It was because (a) SciPy 1.9.0 wasn't quite robust enough, so I recommended downstream packagers to use the setup.py-based build for that release, and (b) Debian has an issue where they can only use a single setuptools version, and they unwisely chose the most recent release, leaving any projects that have issues with setuptools breaking compatibility with distutils out in the cold.

This is a different issue though than the original topic of this issue.

eli-schwartz commented 1 year ago

The same way I encountered a similar bug with cython not found since on debian, cython refers to the cython for python2 and one has to call cython3.

Since Meson 0.63.0, if you use the builtin cython language support it will search for both names: https://github.com/mesonbuild/meson/commit/ebbe4425e7a1c1c16281ef163e443fc1c0a8b209