at master 3.7 kB view raw
1{ 2 lib, 3 stdenv, 4 buildPythonPackage, 5 pythonAtLeast, 6 fetchFromGitHub, 7 8 # build-system 9 setuptools, 10 11 # nativeBuildInputs 12 cython, 13 glibcLocales, 14 15 # dependencies 16 bibtexparser, 17 joblib, 18 matplotlib, 19 monty, 20 networkx, 21 numpy, 22 orjson, 23 palettable, 24 pandas, 25 plotly, 26 pybtex, 27 requests, 28 ruamel-yaml, 29 scipy, 30 spglib, 31 sympy, 32 tabulate, 33 tqdm, 34 uncertainties, 35 36 # optional-dependencies 37 netcdf4, 38 ase, 39 pytest, 40 pytest-cov, 41 invoke, 42 sphinx, 43 sphinx-rtd-theme, 44 numba, 45 vtk, 46 47 # tests 48 addBinToPathHook, 49 moyopy, 50 pytest-xdist, 51 pytestCheckHook, 52}: 53 54buildPythonPackage rec { 55 pname = "pymatgen"; 56 version = "2025.6.14"; 57 pyproject = true; 58 59 disabled = pythonAtLeast "3.13"; 60 61 src = fetchFromGitHub { 62 owner = "materialsproject"; 63 repo = "pymatgen"; 64 tag = "v${version}"; 65 hash = "sha256-HMYYhXT5k/EjG1sIBq/53K9ogeSk8ZEJQBrDHCgz+SA="; 66 }; 67 68 build-system = [ setuptools ]; 69 70 nativeBuildInputs = [ 71 cython 72 glibcLocales 73 ]; 74 75 dependencies = [ 76 bibtexparser 77 joblib 78 matplotlib 79 monty 80 networkx 81 numpy 82 orjson 83 palettable 84 pandas 85 plotly 86 pybtex 87 requests 88 ruamel-yaml 89 scipy 90 spglib 91 sympy 92 tabulate 93 tqdm 94 uncertainties 95 ]; 96 97 optional-dependencies = { 98 abinit = [ netcdf4 ]; 99 ase = [ ase ]; 100 ci = [ 101 pytest 102 pytest-cov 103 # pytest-split 104 ]; 105 docs = [ 106 invoke 107 sphinx 108 # sphinx_markdown_builder 109 sphinx-rtd-theme 110 ]; 111 electronic_structure = [ 112 # fdint 113 ]; 114 mlp = [ 115 # chgnet 116 # matgl 117 ]; 118 numba = [ numba ]; 119 vis = [ vtk ]; 120 }; 121 122 pythonImportsCheck = [ "pymatgen" ]; 123 124 nativeCheckInputs = [ 125 addBinToPathHook 126 moyopy 127 pytestCheckHook 128 pytest-xdist 129 ] 130 ++ lib.flatten (builtins.attrValues optional-dependencies); 131 132 preCheck = 133 # ensure tests can find these 134 '' 135 export PMG_TEST_FILES_DIR="$(realpath ./tests/files)" 136 ''; 137 138 disabledTests = [ 139 # Flaky 140 "test_numerical_eos_values" 141 "test_pca" 142 "test_static_si_no_kgrid" 143 "test_thermal_conductivity" 144 ] 145 ++ lib.optionals (stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isAarch64) [ 146 # AttributeError: 'NoneType' object has no attribute 'items' 147 "test_mean_field" 148 ] 149 ++ lib.optionals stdenv.hostPlatform.isDarwin [ 150 # Fatal Python error: Aborted 151 # matplotlib/backend_bases.py", line 2654 in create_with_canvas 152 # https://github.com/materialsproject/pymatgen/issues/4452 153 "test_angle" 154 "test_as_dict_from_dict" 155 "test_attributes" 156 "test_basic" 157 "test_core_state_eigen" 158 "test_eos_func" 159 "test_get_info_cohps_to_neighbors" 160 "test_get_plot" 161 "test_get_point_group_operations" 162 "test_matplotlib_plots" 163 "test_ph_plot_w_gruneisen" 164 "test_plot" 165 "test_proj_bandstructure_plot" 166 "test_structure" 167 "test_structure_environments" 168 169 # attempt to insert nil object from objects[1] 170 "test_timer_10_2_7" 171 "test_timer" 172 ]; 173 174 disabledTestPaths = lib.optionals stdenv.hostPlatform.isDarwin [ 175 # Crash when running the pmg command 176 # Critical error: required built-in appearance SystemAppearance not found 177 "tests/cli/test_pmg_plot.py" 178 179 # attempt to insert nil object from objects[1] 180 # https://github.com/materialsproject/pymatgen/issues/4452 181 "tests/io/abinit/test_abitimer.py" 182 ]; 183 184 meta = { 185 description = "Robust materials analysis code that defines core object representations for structures and molecules"; 186 homepage = "https://pymatgen.org/"; 187 changelog = "https://github.com/materialsproject/pymatgen/releases/tag/v${version}"; 188 license = lib.licenses.mit; 189 maintainers = with lib.maintainers; [ psyanticy ]; 190 }; 191}