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

llvmlistbot at llvm.org llvmlistbot at llvm.org
Fri Oct 30 09:01:22 PDT 2026


Author: Maksim Levental
Date: 2026-10-30T09:01:14-07:00
New Revision: 80d21b345a2bd9be4716e8a62b83cf93d594f727

URL: https://github.com/llvm/llvm-project/commit/80d21b345a2bd9be4716e8a62b83cf93d594f727
DIFF: https://github.com/llvm/llvm-project/commit/80d21b345a2bd9be4716e8a62b83cf93d594f727.diff

LOG: [MLIR][Python] Drop Python 3.10 and enable Python 3.15 (#232181)

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

For Python 3.15:
- Require nanobind >= 2.13 when building against Python >= 3.15
(`MLIRDetectPythonEnv.cmake` checks `Python3_VERSION`;
`requirements.txt` and the standalone example use `python_version`
markers). Older Pythons keep the 2.9 minimum. nanobind < 2.13's
`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"`.
- For Python >= 3.15 only (via `python_version` markers in
`requirements.txt` and the standalone example), require numpy 2.5.x and
ml_dtypes 0.6.0: they're the first releases with cp315 wheels.
- The standalone example's `requires-python` goes from `>=3.8` to
`>=3.11`.

Assisted by: Claude

Added: 
    

Modified: 
    mlir/cmake/modules/MLIRDetectPythonEnv.cmake
    mlir/examples/standalone/pyproject.toml
    mlir/python/requirements.txt

Removed: 
    


################################################################################
diff  --git a/mlir/cmake/modules/MLIRDetectPythonEnv.cmake b/mlir/cmake/modules/MLIRDetectPythonEnv.cmake
index 5ff28d88110d4c..2424e5c94a8bab 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,15 @@ macro(mlir_configure_python_dev_packages)
       endif()
       set(nanobind_INCLUDE_DIR "${PACKAGE_DIR}")
     endif()
-    find_package(nanobind 2.9 CONFIG REQUIRED)
+    # nanobind < 2.13 doesn't list Python 3.15's PyFrozenDict_Type in
+    # darwin-ld-cpython.sym, so linking against 3.15 fails on macOS.
+    if(Python3_VERSION VERSION_GREATER_EQUAL 3.15)
+      set(_nanobind_min_version 2.13)
+    else()
+      set(_nanobind_min_version 2.9)
+    endif()
+    find_package(nanobind ${_nanobind_min_version} CONFIG REQUIRED)
+    unset(_nanobind_min_version)
     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..8edc11b1f9f25b 100644
--- a/mlir/examples/standalone/pyproject.toml
+++ b/mlir/examples/standalone/pyproject.toml
@@ -6,12 +6,14 @@
 [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; python_version<'3.15'",
+    "numpy>=2.5.0, <=2.5.4; python_version>='3.15'",
     "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'",
+    "ml_dtypes>=0.5.0, <=0.6.0; python_version>='3.13' and python_version<'3.15'",
+    "ml_dtypes==0.6.0; python_version>='3.15'",
 ]
 
 [project.urls]
@@ -24,7 +26,8 @@ Discussions = "https://discourse.llvm.org/"
 requires = [
     "scikit-build-core>=0.10.7",
     "typing_extensions>=4.12.2",
-    "nanobind>=2.9, <3.0",
+    "nanobind>=2.9, <3.0; python_version<'3.15'",
+    "nanobind>=2.13, <3.0; python_version>='3.15'",
 ]
 build-backend = "scikit_build_core.build"
 

diff  --git a/mlir/python/requirements.txt b/mlir/python/requirements.txt
index 7a60966948e8ce..ca3132bf1c4386 100644
--- a/mlir/python/requirements.txt
+++ b/mlir/python/requirements.txt
@@ -1,7 +1,10 @@
 # BUILD dependencies
-nanobind>=2.9, <3.0
+nanobind>=2.9, <3.0; python_version<'3.15'
+nanobind>=2.13, <3.0; python_version>='3.15'
 PyYAML>=5.4.0, <=6.0.3
 typing_extensions>=4.12.2
 # RUN dependencies
-numpy>=2.1.0, <=2.5.4
-ml_dtypes>=0.5.0, <=0.6.0
+numpy>=2.1.0, <=2.5.4; python_version<'3.15'
+numpy>=2.5.0, <=2.5.4; python_version>='3.15'
+ml_dtypes>=0.5.0, <=0.6.0; python_version<'3.15'
+ml_dtypes==0.6.0; python_version>='3.15'


        


More information about the Mlir-commits mailing list