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

Maksim Levental llvmlistbot at llvm.org
Wed Oct 14 22:35:45 PDT 2026


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

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.


>From 446ce70cadaa91a471922c16665bd7e61620bb4e Mon Sep 17 00:00:00 2001
From: makslevental <maksim.levental at gmail.com>
Date: Wed, 14 Oct 2026 22:33:44 -0700
Subject: [PATCH] [MLIR][Python] Drop Python 3.10 and enable Python 3.15

Python 3.10 is EOL, so raise MLIR_MINIMUM_PYTHON_VERSION to 3.11.

For Python 3.15:
- Require nanobind >= 2.13. Earlier versions' darwin-ld-cpython.sym lacks
  PyFrozenDict_Type (new in 3.15), so linking the bindings against 3.15
  fails on macOS with an undefined symbol.
- Raise the numpy cap to 2.5.4; numpy <= 2.4 has no cp315 wheels.
---
 mlir/cmake/modules/MLIRDetectPythonEnv.cmake | 4 ++--
 mlir/examples/standalone/pyproject.toml      | 6 +++---
 mlir/python/requirements.txt                 | 4 ++--
 3 files changed, 7 insertions(+), 7 deletions(-)

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



More information about the Mlir-commits mailing list