summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/dscribe/default.nix
blob: c2644b3da1347ac4486fd62c864c86da73a8acb6 (about) (plain)
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
{
  lib,
  stdenv,
  buildPythonPackage,
  fetchFromGitHub,

  # build-system
  pybind11,
  setuptools,

  # dependencies
  ase,
  joblib,
  numpy,
  scikit-learn,
  scipy,
  sparse,

  # tests
  pytestCheckHook,
}:

buildPythonPackage rec {
  pname = "dscribe";
  version = "2.1.1";

  pyproject = true;

  src = fetchFromGitHub {
    owner = "singroup";
    repo = "dscribe";
    tag = "v${version}";
    fetchSubmodules = true; # Bundles a specific version of Eigen
    hash = "sha256-2JY24cR2ie4+4svVWC4rm3Iy6Wfg0n2vkINz032kPWc=";
  };

  build-system = [
    pybind11
    setuptools
  ];

  dependencies = [
    ase
    joblib
    numpy
    scikit-learn
    scipy
    sparse
  ];

  pythonImportsCheck = [
    "dscribe"
    "dscribe.ext"
  ];

  # Prevents python from loading dscribe from the current working directory instead of using $out
  preCheck = ''
    rm -rf dscribe
  '';

  nativeCheckInputs = [
    pytestCheckHook
  ];

  disabledTests =
    [
      # AttributeError: module 'numpy' has no attribute 'product'
      "test_extended_system"
    ]
    ++ lib.optionals stdenv.hostPlatform.isDarwin [
      # AssertionError on a numerical test
      "test_cell_list"

      # Fatal Python error: Aborted
      # matplotlib/backend_bases.py", line 2654 in create_with_canvas
      "test_examples"
    ];

  meta = {
    description = "Machine learning descriptors for atomistic systems";
    homepage = "https://github.com/SINGROUP/dscribe";
    license = lib.licenses.asl20;
    maintainers = [ lib.maintainers.sheepforce ];
  };
}