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