Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ 2 lib, 3 stdenv, 4 buildPythonPackage, 5 fetchFromGitHub, 6 fetchpatch, 7 cmake, 8 cython, 9 oldest-supported-numpy, 10 scikit-build, 11 setuptools, 12 tbb, 13 numpy, 14 rowan, 15 scipy, 16 pytestCheckHook, 17 python, 18 gsd, 19 matplotlib, 20 sympy, 21}: 22 23buildPythonPackage rec { 24 pname = "freud"; 25 version = "3.1.0"; 26 pyproject = true; 27 28 src = fetchFromGitHub { 29 owner = "glotzerlab"; 30 repo = "freud"; 31 rev = "refs/tags/v${version}"; 32 hash = "sha256-jlscEHQ1q4oqxE06NhVWCOlPRcjDcJVrvy4h6iYrkz0="; 33 fetchSubmodules = true; 34 }; 35 36 patches = [ 37 # https://github.com/glotzerlab/freud/issues/1269 38 (fetchpatch { 39 url = "https://github.com/glotzerlab/freud/commit/8f636e3815737945e45da5b9996b5f69df07c9a5.patch"; 40 hash = "sha256-PLorRrYj16oBWHYzXDq62kECzVTtyr+1Z20DJqTkXxg="; 41 }) 42 ]; 43 44 # Because we prefer to not `leaveDotGit`, we need to fool upstream into 45 # thinking we left the .git files in the submodules, so cmake won't think we 46 # didn't initialize them. Upstream doesn't support using the system wide 47 # installed version of these libraries, and it's probably aint's worth the 48 # hassle, because upstream also doesn't distribute all of these dependencies' 49 # libraries, and probably it uses only what it needs. 50 preConfigure = '' 51 touch extern/{voro++,fsph,Eigen}/.git 52 ''; 53 54 # Scipy still depends on numpy 1, and so we'd get 'package duplicates in 55 # closure' error if we'd use numpy_2 56 postPatch = '' 57 substituteInPlace pyproject.toml \ 58 --replace-fail 'numpy>=2.0.0rc1' 'numpy' \ 59 ''; 60 61 nativeBuildInputs = [ 62 cmake 63 cython 64 oldest-supported-numpy 65 scikit-build 66 setuptools 67 ]; 68 dontUseCmakeConfigure = true; 69 buildInputs = [ tbb ]; 70 71 propagatedBuildInputs = [ 72 numpy 73 rowan 74 scipy 75 ]; 76 77 nativeCheckInputs = [ 78 pytestCheckHook 79 gsd 80 matplotlib 81 sympy 82 ]; 83 disabledTests = lib.optionals stdenv.isAarch64 [ 84 # https://github.com/glotzerlab/freud/issues/961 85 "test_docstring" 86 ]; 87 # On top of cd $out due to https://github.com/NixOS/nixpkgs/issues/255262 , 88 # we need to also copy the tests because otherwise pytest won't find them. 89 preCheck = '' 90 cp -R tests $out/${python.sitePackages}/freud/tests 91 cd $out 92 ''; 93 94 pythonImportsCheck = [ "freud" ]; 95 96 meta = { 97 description = "Powerful, efficient particle trajectory analysis in scientific Python"; 98 homepage = "https://github.com/glotzerlab/freud"; 99 changelog = "https://github.com/glotzerlab/freud/blob/${src.rev}/ChangeLog.md"; 100 license = lib.licenses.bsd3; 101 maintainers = with lib.maintainers; [ doronbehar ]; 102 }; 103}