1{ 2 stdenv, 3 lib, 4 buildPythonPackage, 5 fetchPypi, 6 cython, 7 ecos, 8 joblib, 9 numexpr, 10 numpy, 11 osqp, 12 pandas, 13 setuptools-scm, 14 scikit-learn, 15 scipy, 16 pytestCheckHook, 17}: 18 19buildPythonPackage rec { 20 pname = "scikit-survival"; 21 version = "0.22.2"; 22 pyproject = true; 23 24 src = fetchPypi { 25 inherit pname version; 26 hash = "sha256-DpyGdQwN4VgGYmdREJlPB6NWiVWu8Ur4ExbysxADMr8="; 27 }; 28 29 nativeBuildInputs = [ 30 cython 31 setuptools-scm 32 ]; 33 34 propagatedBuildInputs = [ 35 ecos 36 joblib 37 numexpr 38 numpy 39 osqp 40 pandas 41 scikit-learn 42 scipy 43 ]; 44 45 pythonImportsCheck = [ "sksurv" ]; 46 47 nativeCheckInputs = [ pytestCheckHook ]; 48 49 # treat numpy versions as lower bounds, same as setuptools build 50 postPatch = '' 51 sed -i 's/numpy==/numpy>=/' pyproject.toml 52 ''; 53 54 # Hack needed to make pytest + cython work 55 # https://github.com/NixOS/nixpkgs/pull/82410#issuecomment-827186298 56 preCheck = '' 57 export HOME=$(mktemp -d) 58 cp -r $TMP/$sourceRoot/tests $HOME 59 pushd $HOME 60 ''; 61 postCheck = "popd"; 62 63 # very long tests, unnecessary for a leaf package 64 disabledTests = 65 [ 66 "test_coxph" 67 "test_datasets" 68 "test_ensemble_selection" 69 "test_minlip" 70 "test_pandas_inputs" 71 "test_survival_svm" 72 "test_tree" 73 ] 74 ++ lib.optional (stdenv.isDarwin && stdenv.isAarch64) 75 # floating point mismatch on aarch64 76 # 27079905.88052468 to far from 27079905.880496684 77 "test_coxnet"; 78 79 meta = with lib; { 80 description = "Survival analysis built on top of scikit-learn"; 81 homepage = "https://github.com/sebp/scikit-survival"; 82 license = licenses.gpl3Only; 83 maintainers = with maintainers; [ GuillaumeDesforges ]; 84 }; 85}