From 973d6242fb7ebec71c0d948436be00f85bdf63cc Mon Sep 17 00:00:00 2001 From: whispers Date: Wed, 1 Apr 2026 23:07:20 -0400 Subject: [PATCH] python3Packages.ml-dtypes: include upstream patch for numpy 2.4.3 Numpy 2.4.3 (currently present on staging) changes the float equality semantics for NaN-equivalence, which breaks ml_dtypes' tests. We include an upstream commit to fix this: https://github.com/jax-ml/ml_dtypes/commit/04c4dc8b23720d9d92f3cc849ffc387d5798db84 --- pkgs/development/python-modules/ml-dtypes/default.nix | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pkgs/development/python-modules/ml-dtypes/default.nix b/pkgs/development/python-modules/ml-dtypes/default.nix index fb7f135e6462..a7a8b8cdef9b 100644 --- a/pkgs/development/python-modules/ml-dtypes/default.nix +++ b/pkgs/development/python-modules/ml-dtypes/default.nix @@ -2,6 +2,7 @@ lib, buildPythonPackage, fetchFromGitHub, + fetchpatch2, # build-system setuptools, @@ -30,6 +31,15 @@ buildPythonPackage rec { fetchSubmodules = true; }; + patches = [ + # Fix tests for numpy 2.4.3, which changed the way testing assertions + # handle behaviors with NaN equivalence on the custom numeric types. + (fetchpatch2 { + url = "https://github.com/jax-ml/ml_dtypes/commit/04c4dc8b23720d9d92f3cc849ffc387d5798db84.patch?full_index=1"; + hash = "sha256-jqqiDYcHq58JxSqtHfXcNWFbMFhvufqafDPHmORe6F0="; + }) + ]; + postPatch = '' substituteInPlace pyproject.toml \ --replace-fail "setuptools~=" "setuptools>="