1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchFromGitHub,
6
7 # build-system
8 pybind11,
9 setuptools,
10
11 # dependencies
12 ase,
13 joblib,
14 numpy,
15 scikit-learn,
16 scipy,
17 sparse,
18
19 # tests
20 pytestCheckHook,
21}:
22
23buildPythonPackage rec {
24 pname = "dscribe";
25 version = "2.1.1";
26
27 pyproject = true;
28
29 src = fetchFromGitHub {
30 owner = "singroup";
31 repo = "dscribe";
32 tag = "v${version}";
33 fetchSubmodules = true; # Bundles a specific version of Eigen
34 hash = "sha256-2JY24cR2ie4+4svVWC4rm3Iy6Wfg0n2vkINz032kPWc=";
35 };
36
37 build-system = [
38 pybind11
39 setuptools
40 ];
41
42 dependencies = [
43 ase
44 joblib
45 numpy
46 scikit-learn
47 scipy
48 sparse
49 ];
50
51 pythonImportsCheck = [
52 "dscribe"
53 "dscribe.ext"
54 ];
55
56 # Prevents python from loading dscribe from the current working directory instead of using $out
57 preCheck = ''
58 rm -rf dscribe
59 '';
60
61 nativeCheckInputs = [
62 pytestCheckHook
63 ];
64
65 disabledTests = [
66 # AttributeError: module 'numpy' has no attribute 'product'
67 "test_extended_system"
68 ]
69 ++
70 lib.optionals
71 ((stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isAarch64) || stdenv.hostPlatform.isDarwin)
72 [
73 # AssertionError on a numerical test
74 "test_cell_list"
75 ]
76 ++ lib.optionals stdenv.hostPlatform.isDarwin [
77 # Fatal Python error: Aborted
78 # matplotlib/backend_bases.py", line 2654 in create_with_canvas
79 "test_examples"
80 ];
81
82 # Broken due to use of missing _get_constraints attr in ase >= 3.26.0
83 # https://github.com/SINGROUP/dscribe/issues/160
84 disabledTestPaths = [
85 "tests/test_examples.py::test_examples"
86 "tests/test_general.py::test_atoms_to_system"
87 "tests/test_lmbtr.py"
88 "tests/test_mbtr.py"
89 "tests/test_sinematrix.py"
90 "tests/test_valle_oganov.py"
91 ];
92
93 meta = {
94 description = "Machine learning descriptors for atomistic systems";
95 homepage = "https://github.com/SINGROUP/dscribe";
96 license = lib.licenses.asl20;
97 maintainers = [ lib.maintainers.sheepforce ];
98 };
99}