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.5.1"; 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-ZMOZ4eFtIaIcBPGT6bgAV+47LEGWAAnF/ml68j0fXws="; 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 # hide from tests 86 mv pymatgen _pymatgen 87 # ensure tests can find these 88 export PMG_TEST_FILES_DIR="$(realpath ./tests/files)" 89 # some tests cover the command-line scripts 90 export PATH=$out/bin:$PATH 91 ''; 92 93 disabledTests = [ 94 # presumably won't work with our dir layouts 95 "test_egg_sources_txt_is_complete" 96 # borderline precision failure 97 "test_thermal_conductivity" 98 # AssertionError 99 "test_dict_functionality" 100 "test_mean_field" 101 "test_potcar_not_found" 102 "test_read_write_lobsterin" 103 "test_snl" 104 "test_unconverged" 105 ]; 106 107 pythonImportsCheck = [ "pymatgen" ]; 108 109 meta = with lib; { 110 description = "A robust materials analysis code that defines core object representations for structures and molecules"; 111 homepage = "https://pymatgen.org/"; 112 changelog = "https://github.com/materialsproject/pymatgen/releases/tag/v${version}"; 113 license = licenses.mit; 114 maintainers = with maintainers; [ psyanticy ]; 115 broken = stdenv.isDarwin; # tests segfault. that's bad. 116 }; 117}