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 [
67 # AttributeError: module 'numpy' has no attribute 'product'
68 "test_extended_system"
69 ]
70 ++
71 lib.optionals
72 ((stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isAarch64) || stdenv.hostPlatform.isDarwin)
73 [
74 # AssertionError on a numerical test
75 "test_cell_list"
76 ]
77 ++ lib.optionals stdenv.hostPlatform.isDarwin [
78 # Fatal Python error: Aborted
79 # matplotlib/backend_bases.py", line 2654 in create_with_canvas
80 "test_examples"
81 ];
82
83 meta = {
84 description = "Machine learning descriptors for atomistic systems";
85 homepage = "https://github.com/SINGROUP/dscribe";
86 license = lib.licenses.asl20;
87 maintainers = [ lib.maintainers.sheepforce ];
88 };
89}