[Mlir-commits] [llvm] [mlir] [MLIR][Python] reland (narrower) type stub generation (PR #157930)

Ingo Müller llvmlistbot at llvm.org
Wed Dec 3 08:51:05 PST 2025


ingomueller-net wrote:

*If* a generic type hint is possible, that'd be great. Unfortunately, I haven't found a way, though I stopped investigating after Gemini told me it couldn't be done.

I have looked into using pattern files. Unfortunately, I ran into problems with the CMake rule that MLIR uses: part of the rule expects the pattern file to be a target name (i.e., without slashes), while other parts expect it to be a path (which contains slashes). I experimented with some work-around and run into a limitation of nanobind, which doesn't allow to *add* type annotations; pattern files today only *replace* existing ones. I have created wjakob/nanobind#1235 to overcome this, though.

TL;DR: If someone (not me 😞) manages to make the generic type hints for `Sliceable` work, that'd probably be best. Otherwise, with some pending work, the pattern files should work as well.

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


More information about the Mlir-commits mailing list