Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
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 preCheck =
57 # Prevents python from loading dscribe from the current working directory instead of using $out
58 ''
59 rm -rf dscribe
60 ''
61 # Prevents 'Fatal Python error: Aborted' on darwin during checkPhase
62 + lib.optionalString stdenv.hostPlatform.isDarwin ''
63 export MPLBACKEND="Agg"
64 '';
65
66 nativeCheckInputs = [
67 pytestCheckHook
68 ];
69
70 disabledTests = [
71 # AttributeError: module 'numpy' has no attribute 'product'
72 "test_extended_system"
73 ]
74 ++
75 lib.optionals
76 ((stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isAarch64) || stdenv.hostPlatform.isDarwin)
77 [
78 # AssertionError on a numerical test
79 "test_cell_list"
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}