62 lines
1.3 KiB
Nix
Raw Normal View History

{ buildPythonPackage
2021-05-08 15:17:56 -04:00
, pytestCheckHook
, cmake
, scipy
2019-06-03 18:18:03 +03:00
, scikitlearn
, stdenv
, xgboost
, substituteAll
2019-06-03 18:18:03 +03:00
, pandas
, matplotlib
, graphviz
, datatable
2021-05-08 15:17:56 -04:00
, hypothesis
}:
2019-08-13 21:52:01 +00:00
buildPythonPackage {
pname = "xgboost";
inherit (xgboost) version src meta;
2021-05-08 15:17:56 -04:00
nativeBuildInputs = [ cmake ];
buildInputs = [ xgboost ];
propagatedBuildInputs = [ scipy ];
checkInputs = [
pytestCheckHook
scikitlearn
pandas
matplotlib
graphviz
datatable
hypothesis
];
2021-05-08 15:17:56 -04:00
# Override existing logic for locating libxgboost.so which is not appropriate for Nix
prePatch = let
libPath = "${xgboost}/lib/libxgboost${stdenv.hostPlatform.extensions.sharedLibrary}";
in ''
echo 'find_lib_path = lambda: ["${libPath}"]' > python-package/xgboost/libpath.py
'';
2021-05-08 15:17:56 -04:00
dontUseCmakeConfigure = true;
2021-05-08 15:17:56 -04:00
postPatch = ''
cd python-package
'';
preCheck = ''
ln -sf ../demo .
2021-05-08 15:17:56 -04:00
ln -s ${xgboost}/bin/xgboost ../xgboost
'';
2021-05-08 15:17:56 -04:00
pytestFlagsArray = ["../tests/python"];
disabledTestPaths = [
# Requires internet access: https://github.com/dmlc/xgboost/blob/03cd087da180b7dff21bd8ef34997bf747016025/tests/python/test_ranking.py#L81
"../tests/python/test_ranking.py"
];
disabledTests = [
"test_cli_binary_classification"
"test_model_compatibility"
];
}