[Mlir-commits] [mlir] [MLIR][Python] Drop Python 3.10 and enable Python 3.15 (PR #232181)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Wed Oct 14 22:56:34 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-mlir

Author: Maksim Levental (makslevental)

<details>
<summary>Changes</summary>

Python 3.10 is EOL, so raise `MLIR_MINIMUM_PYTHON_VERSION` to 3.11.

For Python 3.15:
- Require nanobind >= 2.13 (`MLIRDetectPythonEnv.cmake`, `requirements.txt`, the standalone example). Earlier versions' `darwin-ld-cpython.sym` lacks `PyFrozenDict_Type` (new in 3.15), so linking the bindings against 3.15 fails on macOS with `Undefined symbols: "_PyFrozenDict_Type"`.
- Raise the numpy cap from 2.1.2 to 2.5.4: numpy <= 2.4 has no cp315 wheels (and 2.5 has none for 3.11, so pip picks 2.4.x there).
- The standalone example's `requires-python` goes from `>=3.8` to `>=3.11`.

`requirements.txt` resolves on both ends: 3.11 → numpy 2.4.6, 3.15 → numpy 2.5.4 (ml_dtypes 0.6.0 and nanobind 2.15.0 on both). Note PyYAML has no cp315 wheels in any release yet, so it builds from the sdist on 3.15.

Assisted by: Claude


---
Full diff: https://github.com/llvm/llvm-project/pull/232181.diff


3 Files Affected:

- (modified) mlir/cmake/modules/MLIRDetectPythonEnv.cmake (+2-2) 
- (modified) mlir/examples/standalone/pyproject.toml (+3-3) 
- (modified) mlir/python/requirements.txt (+2-2) 


``````````diff
diff --git a/mlir/cmake/modules/MLIRDetectPythonEnv.cmake b/mlir/cmake/modules/MLIRDetectPythonEnv.cmake
index 5ff28d88110d4c..bf598c56848bcb 100644
--- a/mlir/cmake/modules/MLIRDetectPythonEnv.cmake
+++ b/mlir/cmake/modules/MLIRDetectPythonEnv.cmake
@@ -1,6 +1,6 @@
 # Macros and functions related to detecting details of the Python environment.
 
-set(MLIR_MINIMUM_PYTHON_VERSION 3.10)
+set(MLIR_MINIMUM_PYTHON_VERSION 3.11)
 # Finds and configures python packages needed to build MLIR Python bindings.
 macro(mlir_configure_python_dev_packages)
   if(NOT MLIR_DISABLE_CONFIGURE_PYTHON_DEV_PACKAGES)
@@ -81,7 +81,7 @@ macro(mlir_configure_python_dev_packages)
       endif()
       set(nanobind_INCLUDE_DIR "${PACKAGE_DIR}")
     endif()
-    find_package(nanobind 2.9 CONFIG REQUIRED)
+    find_package(nanobind 2.13 CONFIG REQUIRED)
     message(STATUS "Found nanobind v${nanobind_VERSION}")
   endif()
 endmacro()
diff --git a/mlir/examples/standalone/pyproject.toml b/mlir/examples/standalone/pyproject.toml
index 8fe29d6f897c48..106c9d79b74e7f 100644
--- a/mlir/examples/standalone/pyproject.toml
+++ b/mlir/examples/standalone/pyproject.toml
@@ -6,9 +6,9 @@
 [project]
 name = "standalone-python-bindings"
 version = "0.0.1"
-requires-python = ">=3.8"
+requires-python = ">=3.11"
 dependencies = [
-    "numpy>=1.19.5, <=2.1.2",
+    "numpy>=1.19.5, <=2.5.4",
     "PyYAML>=5.4.0, <=6.0.1",
     "ml_dtypes>=0.1.0, <=0.6.0; python_version<'3.13'",
     "ml_dtypes>=0.5.0, <=0.6.0; python_version>='3.13'",
@@ -24,7 +24,7 @@ Discussions = "https://discourse.llvm.org/"
 requires = [
     "scikit-build-core>=0.10.7",
     "typing_extensions>=4.12.2",
-    "nanobind>=2.9, <3.0",
+    "nanobind>=2.13, <3.0",
 ]
 build-backend = "scikit_build_core.build"
 
diff --git a/mlir/python/requirements.txt b/mlir/python/requirements.txt
index d35cb894f21a5a..114008a2555f51 100644
--- a/mlir/python/requirements.txt
+++ b/mlir/python/requirements.txt
@@ -1,7 +1,7 @@
 # BUILD dependencies
-nanobind>=2.9, <3.0
+nanobind>=2.13, <3.0
 PyYAML>=5.4.0, <=6.0.3
 typing_extensions>=4.12.2
 # RUN dependencies
-numpy>=2.1.0, <=2.1.2
+numpy>=2.1.0, <=2.5.4
 ml_dtypes>=0.5.0, <=0.6.0

``````````

</details>


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


More information about the Mlir-commits mailing list