1{ stdenv
2, lib
3, buildPythonPackage
4, fetchPypi
5, cython
6, ecos
7, joblib
8, numexpr
9, numpy
10, osqp
11, pandas
12, setuptools-scm
13, scikit-learn
14, scipy
15, pytestCheckHook
16}:
17
18buildPythonPackage rec {
19 pname = "scikit-survival";
20 version = "0.18.0";
21
22 src = fetchPypi {
23 inherit pname version;
24 sha256 = "sha256-LfQESmKxSJ4tWlp3EZTBajOxZC3IEOUtJmX8A5ROpmU=";
25 };
26
27 nativeBuildInputs = [
28 cython
29 setuptools-scm
30 ];
31
32 propagatedBuildInputs = [
33 ecos
34 joblib
35 numexpr
36 numpy
37 osqp
38 pandas
39 scikit-learn
40 scipy
41 ];
42
43 pythonImportsCheck = [ "sksurv" ];
44
45 checkInputs = [ pytestCheckHook ];
46
47 # Hack needed to make pytest + cython work
48 # https://github.com/NixOS/nixpkgs/pull/82410#issuecomment-827186298
49 preCheck = ''
50 export HOME=$(mktemp -d)
51 cp -r $TMP/$sourceRoot/tests $HOME
52 pushd $HOME
53 '';
54 postCheck = "popd";
55
56 # very long tests, unnecessary for a leaf package
57 disabledTests = [
58 "test_coxph"
59 "test_datasets"
60 "test_ensemble_selection"
61 "test_minlip"
62 "test_pandas_inputs"
63 "test_survival_svm"
64 "test_tree"
65 ];
66
67 meta = with lib; {
68 broken = (stdenv.isLinux && stdenv.isAarch64);
69 description = "Survival analysis built on top of scikit-learn";
70 homepage = "https://github.com/sebp/scikit-survival";
71 license = licenses.gpl3Only;
72 maintainers = with maintainers; [ GuillaumeDesforges ];
73 };
74}