2022-06-16 17:23:12 +00:00
|
|
|
{ stdenv
|
|
|
|
, lib
|
2021-08-12 14:41:47 +00:00
|
|
|
, buildPythonPackage
|
|
|
|
, fetchPypi
|
|
|
|
, cython
|
|
|
|
, ecos
|
|
|
|
, joblib
|
|
|
|
, numexpr
|
|
|
|
, numpy
|
|
|
|
, osqp
|
|
|
|
, pandas
|
2022-02-10 20:34:41 +00:00
|
|
|
, setuptools-scm
|
2021-08-12 14:41:47 +00:00
|
|
|
, scikit-learn
|
|
|
|
, scipy
|
|
|
|
, pytestCheckHook
|
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "scikit-survival";
|
2024-01-02 11:29:13 +00:00
|
|
|
version = "0.22.2";
|
2023-11-16 04:20:00 +00:00
|
|
|
pyproject = true;
|
2021-08-12 14:41:47 +00:00
|
|
|
|
|
|
|
src = fetchPypi {
|
|
|
|
inherit pname version;
|
2024-01-02 11:29:13 +00:00
|
|
|
hash = "sha256-DpyGdQwN4VgGYmdREJlPB6NWiVWu8Ur4ExbysxADMr8=";
|
2021-08-12 14:41:47 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
cython
|
2022-02-10 20:34:41 +00:00
|
|
|
setuptools-scm
|
2021-08-12 14:41:47 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
propagatedBuildInputs = [
|
|
|
|
ecos
|
|
|
|
joblib
|
|
|
|
numexpr
|
|
|
|
numpy
|
|
|
|
osqp
|
|
|
|
pandas
|
|
|
|
scikit-learn
|
|
|
|
scipy
|
|
|
|
];
|
|
|
|
|
|
|
|
pythonImportsCheck = [ "sksurv" ];
|
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [ pytestCheckHook ];
|
2021-08-12 14:41:47 +00:00
|
|
|
|
2023-11-16 04:20:00 +00:00
|
|
|
# treat numpy versions as lower bounds, same as setuptools build
|
|
|
|
postPatch = ''
|
|
|
|
sed -i 's/numpy==/numpy>=/' pyproject.toml
|
|
|
|
'';
|
|
|
|
|
2021-08-12 14:41:47 +00:00
|
|
|
# Hack needed to make pytest + cython work
|
|
|
|
# https://github.com/NixOS/nixpkgs/pull/82410#issuecomment-827186298
|
|
|
|
preCheck = ''
|
|
|
|
export HOME=$(mktemp -d)
|
|
|
|
cp -r $TMP/$sourceRoot/tests $HOME
|
|
|
|
pushd $HOME
|
|
|
|
'';
|
|
|
|
postCheck = "popd";
|
|
|
|
|
|
|
|
# very long tests, unnecessary for a leaf package
|
|
|
|
disabledTests = [
|
|
|
|
"test_coxph"
|
|
|
|
"test_datasets"
|
|
|
|
"test_ensemble_selection"
|
|
|
|
"test_minlip"
|
|
|
|
"test_pandas_inputs"
|
|
|
|
"test_survival_svm"
|
|
|
|
"test_tree"
|
2023-11-16 04:20:00 +00:00
|
|
|
] ++ lib.optional (stdenv.isDarwin && stdenv.isAarch64)
|
|
|
|
# floating point mismatch on aarch64
|
|
|
|
# 27079905.88052468 to far from 27079905.880496684
|
|
|
|
"test_coxnet"
|
|
|
|
;
|
2021-08-12 14:41:47 +00:00
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Survival analysis built on top of scikit-learn";
|
|
|
|
homepage = "https://github.com/sebp/scikit-survival";
|
|
|
|
license = licenses.gpl3Only;
|
|
|
|
maintainers = with maintainers; [ GuillaumeDesforges ];
|
|
|
|
};
|
|
|
|
}
|