[Mlir-commits] [mlir] [mlir][python] Make test stubgen depend on _mlirRegisterEverything (PR #235462)

Maksim Levental llvmlistbot at llvm.org
Sun Oct 25 11:47:36 PDT 2026


makslevental wrote:

> That runs `mlir/_mlir_libs/__init__.py`, whose `_site_initialize()` also imports `_mlirRegisterEverything`. The stubgen rule doesn't depend on that extension, so ninja can run stubgen before it has been rebuilt.

This isn't correct; `_site_initialize` _tries_ to import `_mlirRegisterEverything` and gracefully fails if it's not available

https://github.com/llvm/llvm-project/blob/349a6f32347e443511900ccfa87157dded83cb98/mlir/python/mlir/_mlir_libs/__init__.py#L112-L114

which is the case for lots of projects which only build the bindings for a subset of dialects.

> Generating the type stub for `_mlirPythonTestNanobind`

Is this an issue you're seeing only in generating this stub? I don't expect it is but I'm just double checking

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


More information about the Mlir-commits mailing list