[llvm] [mlir] [MLIR][Python] use `FetchContent_Declare` for nanobind and remove pybind (PR #161230)

Jordan Rupprecht via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 7 09:57:01 PDT 2025


rupprecht wrote:

> > We still have a lot of usage of pybind, some of which is fairly simple to migrate, but much of which relies on some bindings/type coverters we haven't implemented for nanobind yet (e.g. `absl::StatusOr`, protos).
> 
> You can just take the deleted `PybindAdaptors.h` and use it unchanged in your downstream project. That's the only thing that materially changes (and the CMake). If your project is public I can take a look and show you how.
> 

I think that works. Copying it could add maintenance cost, but `PybindAdaptors.h` hasn't been updated since Dec 2024, so odds are we won't need to make any downstream changes. Hopefully we can migrate to nanobind relatively quickly, but closer to O(weeks) instead of O(days).

> > Also, I don't actually see the deprecation status anywhere -- was it announced or documented anywhere that pybind support was being removed? I'd like to request a revert, at least temporarily, so we have some more lead time to migrate things over.
> 
> The switch to nanobind occurred November of last year. The upstream bindings had zero nanobind code since then. These last bits, which were just a single header, the CMake and tests, were announced to be removed last week.
> 
> https://discourse.llvm.org/t/psa-removing-pybind11-support/88465

Ah, ok. There is also a category specifically for deprecations that would be good to use next time: https://discourse.llvm.org/c/mlir/mlir-deprecation/77. Not saying I definitely would have noticed it if you pinged that category though.

I also expected to see some sort of deprecation comment/annotation in mlir/include/mlir/Bindings/Python/PybindAdaptors.h itself.

I think we'd be OK relanding that part of it, though it sounds like @tstellar / @kwk might have some comments about cmake.

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


More information about the llvm-commits mailing list