#16205·meson

Deprecate passing an argument to `import('python').find_installation()`

Author: dnicolodiCreated Sep 10, 2026Updated Sep 20, 2026

I have been thinking about a way to solve #15740.

I see two possible solution: relax the sanity check to do not compile and link the produced code, or rework the sanity check to use the same method to look up the Python dependency used by import('python').find_installation().dependency(). I assume that relaxing the sanity check is not really desirable (although it was that way till recently and I haven't see complaints about it).

Reworking the python dependency lookup to work the same as the Meson's python module should work in the vast majority of cases: the sanity check would be representative of what any use of cython would be in the compilation process. The only instances where this could diverge is when meson.build passes an argument to import('python').find_installation() to look up a Python installation that is not the default one, or the one passed via a machine file, nor the one pointed to via the python.build_detail setup option. The value of this argument is not available when the Cython sanity check is executed, thus I don't see a way to solve this.

However, I argue that overriding the Python environment lookup via the argument passed to import('python').find_installation() is not necessary and can be deprecated in favour of passing the path to the python binary via a machine file.

@eli-schwartz @rgommers Thoughts?