summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/xgboost/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/python-modules/xgboost/default.nix')
-rw-r--r--pkgs/development/python-modules/xgboost/default.nix54
1 files changed, 39 insertions, 15 deletions
diff --git a/pkgs/development/python-modules/xgboost/default.nix b/pkgs/development/python-modules/xgboost/default.nix
index 81a8d05f5bf0..4f02d72c9a18 100644
--- a/pkgs/development/python-modules/xgboost/default.nix
+++ b/pkgs/development/python-modules/xgboost/default.nix
@@ -1,8 +1,8 @@
{ buildPythonPackage
-, pytest
-, nose
+, pytestCheckHook
+, cmake
, scipy
-, scikitlearn
+, scikit-learn
, stdenv
, xgboost
, substituteAll
@@ -10,28 +10,52 @@
, matplotlib
, graphviz
, datatable
+, hypothesis
}:
buildPythonPackage {
pname = "xgboost";
inherit (xgboost) version src meta;
- patches = [
- (substituteAll {
- src = ./lib-path-for-python.patch;
- libpath = "${xgboost}/lib";
- extention = stdenv.hostPlatform.extensions.sharedLibrary;
- })
+ nativeBuildInputs = [ cmake ];
+ buildInputs = [ xgboost ];
+ propagatedBuildInputs = [ scipy ];
+ checkInputs = [
+ pytestCheckHook
+ scikit-learn
+ pandas
+ matplotlib
+ graphviz
+ datatable
+ hypothesis
];
- postPatch = "cd python-package";
+ # 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
+ '';
- propagatedBuildInputs = [ scipy ];
- buildInputs = [ xgboost ];
- checkInputs = [ nose pytest scikitlearn pandas matplotlib graphviz datatable ];
+ dontUseCmakeConfigure = true;
- checkPhase = ''
+ postPatch = ''
+ cd python-package
+ '';
+
+ preCheck = ''
ln -sf ../demo .
- nosetests ../tests/python
+ ln -s ${xgboost}/bin/xgboost ../xgboost
'';
+
+ 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"
+ ];
+
}