From 157eb0e4eb8e6a370b0542f57c4d626daa7d6f66 Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Wed, 10 Jul 2024 11:16:31 +0300 Subject: [PATCH 1/4] python312Packages.freud: fix numpy version check --- pkgs/development/python-modules/freud/default.nix | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkgs/development/python-modules/freud/default.nix b/pkgs/development/python-modules/freud/default.nix index 49a25ed500e3..e6bfd2af341b 100644 --- a/pkgs/development/python-modules/freud/default.nix +++ b/pkgs/development/python-modules/freud/default.nix @@ -39,6 +39,13 @@ buildPythonPackage rec { touch extern/{voro++,fsph,Eigen}/.git ''; + # Scipy still depends on numpy 1, and so we'd get 'package duplicates in + # closure' error if we'd use numpy_2 + postPatch = '' + substituteInPlace pyproject.toml \ + --replace-fail 'numpy>=2.0.0rc1' 'numpy' \ + ''; + nativeBuildInputs = [ cmake cython From 732c65bc8348473cf71bc1468b4f25d2b9f8c516 Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Wed, 10 Jul 2024 12:38:34 +0300 Subject: [PATCH 2/4] python312Packages.freud: use pytestCheckHook --- .../python-modules/freud/default.nix | 28 +++++++++---------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/pkgs/development/python-modules/freud/default.nix b/pkgs/development/python-modules/freud/default.nix index e6bfd2af341b..10ddbedfb320 100644 --- a/pkgs/development/python-modules/freud/default.nix +++ b/pkgs/development/python-modules/freud/default.nix @@ -11,7 +11,8 @@ , numpy , rowan , scipy -, pytest +, pytestCheckHook +, python , gsd , matplotlib , sympy @@ -65,25 +66,22 @@ buildPythonPackage rec { ]; nativeCheckInputs = [ - # Encountering circular ImportError issues with pytestCheckHook, see also: - # https://github.com/NixOS/nixpkgs/issues/255262 - pytest + pytestCheckHook gsd matplotlib sympy ]; - checkPhase = '' - runHook preCheck - - pytest - - runHook postCheck + disabledTests = [ + ] ++ lib.optionals stdenv.isAarch64 [ + # https://github.com/glotzerlab/freud/issues/961 + "test_docstring" + ]; + # On top of cd $out due to https://github.com/NixOS/nixpkgs/issues/255262 , + # we need to also copy the tests because otherwise pytest won't find them. + preCheck = '' + cp -R tests $out/${python.sitePackages}/freud/tests + cd $out ''; - # Some tests fail on aarch64. If we could have used pytestCheckHook, we would - # have disabled only the tests that fail with the disabledTests attribute. - # But that is not possible unfortunately. See upstream report for the - # failure: https://github.com/glotzerlab/freud/issues/961 - doCheck = !stdenv.isAarch64; pythonImportsCheck = [ "freud" ]; From 6a9f871ac36ee88b99101b80ae9a95e3353fe862 Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Wed, 10 Jul 2024 12:57:51 +0300 Subject: [PATCH 3/4] python312Packages.freud: fix test_attribute_shapes --- pkgs/development/python-modules/freud/default.nix | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pkgs/development/python-modules/freud/default.nix b/pkgs/development/python-modules/freud/default.nix index 10ddbedfb320..4001ffbac2fc 100644 --- a/pkgs/development/python-modules/freud/default.nix +++ b/pkgs/development/python-modules/freud/default.nix @@ -2,6 +2,7 @@ , stdenv , buildPythonPackage , fetchFromGitHub +, fetchpatch , cmake , cython , oldest-supported-numpy @@ -30,6 +31,15 @@ buildPythonPackage rec { hash = "sha256-jlscEHQ1q4oqxE06NhVWCOlPRcjDcJVrvy4h6iYrkz0="; fetchSubmodules = true; }; + + patches = [ + # https://github.com/glotzerlab/freud/issues/1269 + (fetchpatch { + url = "https://github.com/glotzerlab/freud/commit/8f636e3815737945e45da5b9996b5f69df07c9a5.patch"; + hash = "sha256-PLorRrYj16oBWHYzXDq62kECzVTtyr+1Z20DJqTkXxg="; + }) + ]; + # Because we prefer to not `leaveDotGit`, we need to fool upstream into # thinking we left the .git files in the submodules, so cmake won't think we # didn't initialize them. Upstream doesn't support using the system wide From 74ccd6656c6819f41db54983bba026e2f1682cd5 Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Wed, 10 Jul 2024 17:57:16 +0300 Subject: [PATCH 4/4] python312Packages.freud: rfc 166 formattings --- .../python-modules/freud/default.nix | 52 +++++++++---------- 1 file changed, 25 insertions(+), 27 deletions(-) diff --git a/pkgs/development/python-modules/freud/default.nix b/pkgs/development/python-modules/freud/default.nix index 4001ffbac2fc..a681bd1f14b1 100644 --- a/pkgs/development/python-modules/freud/default.nix +++ b/pkgs/development/python-modules/freud/default.nix @@ -1,22 +1,23 @@ -{ lib -, stdenv -, buildPythonPackage -, fetchFromGitHub -, fetchpatch -, cmake -, cython -, oldest-supported-numpy -, scikit-build -, setuptools -, tbb -, numpy -, rowan -, scipy -, pytestCheckHook -, python -, gsd -, matplotlib -, sympy +{ + lib, + stdenv, + buildPythonPackage, + fetchFromGitHub, + fetchpatch, + cmake, + cython, + oldest-supported-numpy, + scikit-build, + setuptools, + tbb, + numpy, + rowan, + scipy, + pytestCheckHook, + python, + gsd, + matplotlib, + sympy, }: buildPythonPackage rec { @@ -65,9 +66,7 @@ buildPythonPackage rec { setuptools ]; dontUseCmakeConfigure = true; - buildInputs = [ - tbb - ]; + buildInputs = [ tbb ]; propagatedBuildInputs = [ numpy @@ -81,8 +80,7 @@ buildPythonPackage rec { matplotlib sympy ]; - disabledTests = [ - ] ++ lib.optionals stdenv.isAarch64 [ + disabledTests = lib.optionals stdenv.isAarch64 [ # https://github.com/glotzerlab/freud/issues/961 "test_docstring" ]; @@ -95,11 +93,11 @@ buildPythonPackage rec { pythonImportsCheck = [ "freud" ]; - meta = with lib; { + meta = { description = "Powerful, efficient particle trajectory analysis in scientific Python"; homepage = "https://github.com/glotzerlab/freud"; changelog = "https://github.com/glotzerlab/freud/blob/${src.rev}/ChangeLog.md"; - license = licenses.bsd3; - maintainers = with maintainers; [ doronbehar ]; + license = lib.licenses.bsd3; + maintainers = with lib.maintainers; [ doronbehar ]; }; }