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