1{
2 lib,
3 stdenv,
4 ase,
5 buildPythonPackage,
6 cython,
7 fetchFromGitHub,
8 glibcLocales,
9 joblib,
10 matplotlib,
11 monty,
12 networkx,
13 oldest-supported-numpy,
14 palettable,
15 pandas,
16 plotly,
17 pybtex,
18 pydispatcher,
19 pytest-xdist,
20 pytestCheckHook,
21 pythonOlder,
22 requests,
23 ruamel-yaml,
24 scipy,
25 seekpath,
26 setuptools,
27 spglib,
28 sympy,
29 tabulate,
30 uncertainties,
31}:
32
33buildPythonPackage rec {
34 pname = "pymatgen";
35 version = "2024.7.18";
36 pyproject = true;
37
38 disabled = pythonOlder "3.8";
39
40 src = fetchFromGitHub {
41 owner = "materialsproject";
42 repo = "pymatgen";
43 rev = "refs/tags/v${version}";
44 hash = "sha256-LL3cZO3LkmBuGGcO7dhO2Wtgqx9nxLureFpC8EqvS3M";
45 };
46
47 build-system = [ setuptools ];
48
49 nativeBuildInputs = [
50 cython
51 glibcLocales
52 ];
53
54 dependencies = [
55 matplotlib
56 monty
57 networkx
58 oldest-supported-numpy
59 palettable
60 pandas
61 plotly
62 pybtex
63 pydispatcher
64 requests
65 ruamel-yaml
66 scipy
67 spglib
68 sympy
69 tabulate
70 uncertainties
71 ];
72
73 passthru.optional-dependencies = {
74 ase = [ ase ];
75 joblib = [ joblib ];
76 seekpath = [ seekpath ];
77 };
78
79 nativeCheckInputs = [
80 pytestCheckHook
81 pytest-xdist
82 ] ++ lib.flatten (builtins.attrValues passthru.optional-dependencies);
83
84 preCheck = ''
85 # ensure tests can find these
86 export PMG_TEST_FILES_DIR="$(realpath ./tests/files)"
87 # some tests cover the command-line scripts
88 export PATH=$out/bin:$PATH
89 '';
90
91 disabledTests = [
92 # presumably won't work with our dir layouts
93 "test_egg_sources_txt_is_complete"
94 # borderline precision failure
95 "test_thermal_conductivity"
96 # AssertionError
97 "test_dict_functionality"
98 "test_mean_field"
99 "test_potcar_not_found"
100 "test_read_write_lobsterin"
101 "test_snl"
102 "test_unconverged"
103 ];
104
105 pythonImportsCheck = [ "pymatgen" ];
106
107 meta = with lib; {
108 description = "Robust materials analysis code that defines core object representations for structures and molecules";
109 homepage = "https://pymatgen.org/";
110 changelog = "https://github.com/materialsproject/pymatgen/releases/tag/v${version}";
111 license = licenses.mit;
112 maintainers = with maintainers; [ psyanticy ];
113 broken = true; # tests segfault. that's bad.
114 };
115}