about summary refs log tree commit diff
path: root/pkgs/development/python-modules/freud/default.nix
blob: 49a25ed500e36f6db45cfb0095e9607290bdcc55 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
{ lib
, stdenv
, buildPythonPackage
, fetchFromGitHub
, cmake
, cython
, oldest-supported-numpy
, scikit-build
, setuptools
, tbb
, numpy
, rowan
, scipy
, pytest
, gsd
, matplotlib
, sympy
}:

buildPythonPackage rec {
  pname = "freud";
  version = "3.1.0";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "glotzerlab";
    repo = "freud";
    rev = "refs/tags/v${version}";
    hash = "sha256-jlscEHQ1q4oqxE06NhVWCOlPRcjDcJVrvy4h6iYrkz0=";
    fetchSubmodules = true;
  };
  # 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
  # installed version of these libraries, and it's probably aint's worth the
  # hassle, because upstream also doesn't distribute all of these dependencies'
  # libraries, and probably it uses only what it needs.
  preConfigure = ''
    touch extern/{voro++,fsph,Eigen}/.git
  '';

  nativeBuildInputs = [
    cmake
    cython
    oldest-supported-numpy
    scikit-build
    setuptools
  ];
  dontUseCmakeConfigure = true;
  buildInputs = [
    tbb
  ];

  propagatedBuildInputs = [
    numpy
    rowan
    scipy
  ];

  nativeCheckInputs = [
    # Encountering circular ImportError issues with pytestCheckHook, see also:
    # https://github.com/NixOS/nixpkgs/issues/255262
    pytest
    gsd
    matplotlib
    sympy
  ];
  checkPhase = ''
    runHook preCheck

    pytest

    runHook postCheck
  '';
  # 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" ];

  meta = with lib; {
    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 ];
  };
}