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