1{ 2 lib, 3 stdenv, 4 buildPythonPackage, 5 fetchFromGitHub, 6 7 # build-system 8 hatch-vcs, 9 hatchling, 10 11 # dependencies 12 h5py, 13 numpy, 14 wasserstein, 15 16 # optional-dependencies 17 igraph, 18 scikit-learn, 19 tensorflow, 20 21 # tests 22 pot, 23 pytestCheckHook, 24 tf-keras, 25}: 26 27buildPythonPackage rec { 28 pname = "energyflow"; 29 version = "1.4.0"; 30 pyproject = true; 31 32 src = fetchFromGitHub { 33 owner = "pkomiske"; 34 repo = "EnergyFlow"; 35 tag = "v${version}"; 36 hash = "sha256-4RzhpeOOty8IaVGByHD+PyeaeWgR7ZF98mSCJYoM9wY="; 37 }; 38 39 build-system = [ 40 hatch-vcs 41 hatchling 42 ]; 43 44 dependencies = [ 45 h5py 46 numpy 47 wasserstein 48 ]; 49 50 optional-dependencies = { 51 all = [ 52 igraph 53 scikit-learn 54 tensorflow 55 ]; 56 archs = [ 57 scikit-learn 58 tensorflow 59 ]; 60 generation = [ igraph ]; 61 }; 62 63 nativeCheckInputs = [ 64 pot 65 pytestCheckHook 66 tf-keras 67 ] 68 ++ lib.flatten (builtins.attrValues optional-dependencies); 69 70 disabledTests = [ 71 # Issues with array 72 "test_emd_equivalence" 73 "test_gdim" 74 "test_n_jobs" 75 "test_periodic_phi" 76 ] 77 ++ lib.optionals stdenv.hostPlatform.isDarwin [ 78 # RuntimeError: EMDStatus - Infeasible 79 "test_emd_byhand_1_1" 80 "test_emd_return_flow" 81 "test_emde" 82 ]; 83 84 pythonImportsCheck = [ "energyflow" ]; 85 86 meta = { 87 description = "Python package for the EnergyFlow suite of tools"; 88 homepage = "https://energyflow.network/"; 89 changelog = "https://github.com/thaler-lab/EnergyFlow/releases/tag/v${version}"; 90 license = lib.licenses.gpl3Only; 91 maintainers = with lib.maintainers; [ veprbl ]; 92 }; 93}