[Mlir-commits] [mlir] [MLIR][Python] Extend bindings for external projects without duplication (PR #173241)

Sylvain Noiry llvmlistbot at llvm.org
Tue Dec 23 06:45:47 PST 2025


ElectrikSpace wrote:

Thank you for the review.

I was doing the patch in LLVM-21, so I didn't see `MLIR_PYTHON_PACKAGE_PREFIX`. So yes we can reuse it, if it always correspond to the upstream/main mlir package, to oppose to something like `MY_PROJECT_PYTHON_PACKAGE_PREFIX`.

For the "DISABLE_INSTALL", this was just a way to link with `libMLIRPythonCAPI.so` without having to find in the mlir package (e.g. `python_packages/mlir_core/mlir/_mlir_libs/libMLIRPythonCAPI.so`), but I can remove it.

The use case for all this that I work on a project that uses MLIR Python bindings from a wheel (https://gitlab.inria.fr/CORSE/mlir-bindings-wheels), and I want to optionally use external projects (more than one) to extend it, that are installed using wheels. So I want every project to use the same `libMLIRPythonCAPI.so`, which is linked statically for now. At the end I should end up with a dependency to the mlir wheel for each external project, and it should work.

Except the import paths transformed from relative to absolute in `mlir-tablgen` I don't want to change how existing projects and upstream are built and linked.

https://github.com/llvm/llvm-project/pull/173241


More information about the Mlir-commits mailing list