python3Packages.mlx: 0.31.2 -> 0.32.0 (#543261)

This commit is contained in:
Ihar Hrachyshka
2026-07-21 00:01:45 +00:00
committed by GitHub
3 changed files with 3 additions and 50 deletions
@@ -1,16 +0,0 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ab8aea44..9e1b06f4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -100,10 +100,7 @@ elseif(MLX_BUILD_METAL)
endif()
# Throw an error if xcrun not found
- execute_process(
- COMMAND zsh "-c" "/usr/bin/xcrun -sdk macosx --show-sdk-version"
- OUTPUT_VARIABLE MACOS_SDK_VERSION
- OUTPUT_STRIP_TRAILING_WHITESPACE COMMAND_ERROR_IS_FATAL ANY)
+ set(MACOS_SDK_VERSION @sdkVersion@)
if(${MACOS_SDK_VERSION} LESS 14.0)
message(
@@ -3,7 +3,6 @@
stdenv,
buildPythonPackage,
fetchFromGitHub,
replaceVars,
nanobind,
# build-system
@@ -12,7 +11,6 @@
typing-extensions,
# buildInputs
apple-sdk,
fmt,
nlohmann_json,
# linux-only
@@ -20,7 +18,6 @@
# tests
numpy,
psutil,
pytestCheckHook,
python,
runCommand,
@@ -42,7 +39,7 @@ let
in
buildPythonPackage (finalAttrs: {
pname = "mlx";
version = "0.31.2";
version = "0.32.0";
pyproject = true;
__structuredAttrs = true;
@@ -50,18 +47,12 @@ buildPythonPackage (finalAttrs: {
owner = "ml-explore";
repo = "mlx";
tag = "v${finalAttrs.version}";
hash = "sha256-0Oxacz61WGWZrpWw+fMQjEQfwOx1l1L2d0kWl54/LrQ=";
hash = "sha256-yHpTyRf9FOPbdyDWSM7b6VC72STnUpgCMLbDxLbdaqs=";
};
patches = [
# Use nix packages instead of fetching their sources
./dont-fetch-nanobind.patch
./dont-fetch-json.patch
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
(replaceVars ./darwin-build-fixes.patch {
sdkVersion = apple-sdk.version;
})
];
postPatch = ''
@@ -92,10 +83,8 @@ buildPythonPackage (finalAttrs: {
(lib.cmakeBool "MLX_BUILD_METAL" false)
(lib.cmakeBool "USE_SYSTEM_FMT" true)
(lib.cmakeOptionType "filepath" "FETCHCONTENT_SOURCE_DIR_GGUFLIB" "${gguf-tools}")
(lib.cmakeOptionType "filepath" "FETCHCONTENT_SOURCE_DIR_NANOBIND" "${nanobind.src}")
(lib.cmakeFeature "CMAKE_CXX_FLAGS" "-I${lib.getDev nlohmann_json}/include/nlohmann")
# Cmake cannot find nanobind-config.cmake by itself
(lib.cmakeFeature "nanobind_DIR" "${nanobind}/${python.sitePackages}/nanobind/cmake")
]
++ lib.optionals (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isx86_64) [
(lib.cmakeBool "MLX_ENABLE_X64_MAC" true)
@@ -122,7 +111,6 @@ buildPythonPackage (finalAttrs: {
# Run the mlx Python test suite.
nativeCheckInputs = [
numpy
psutil
pytestCheckHook
];
@@ -1,19 +0,0 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a2395d02..6d24df02 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -354,13 +354,7 @@ if(MLX_BUILD_PYTHON_BINDINGS)
Python 3.10
COMPONENTS Interpreter Development.Module
REQUIRED)
- FetchContent_Declare(
- nanobind
- GIT_REPOSITORY https://github.com/wjakob/nanobind.git
- GIT_TAG v2.12.0
- GIT_SHALLOW TRUE
- EXCLUDE_FROM_ALL)
- FetchContent_MakeAvailable(nanobind)
+ find_package(nanobind CONFIG REQUIRED)
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/python/src)
endif()