1{
2 buildPythonPackage,
3 pythonOlder,
4 cmake,
5 numpy,
6 scipy,
7 hatchling,
8 stdenv,
9 xgboost,
10}:
11
12buildPythonPackage {
13 pname = "xgboost";
14 format = "pyproject";
15 inherit (xgboost) version src meta;
16
17 disabled = pythonOlder "3.8";
18
19 nativeBuildInputs = [
20 cmake
21 hatchling
22 ];
23 buildInputs = [ xgboost ];
24 propagatedBuildInputs = [
25 numpy
26 scipy
27 ];
28
29 # Override existing logic for locating libxgboost.so which is not appropriate for Nix
30 prePatch =
31 let
32 libPath = "${xgboost}/lib/libxgboost${stdenv.hostPlatform.extensions.sharedLibrary}";
33 in
34 ''
35 echo 'find_lib_path = lambda: ["${libPath}"]' > python-package/xgboost/libpath.py
36 '';
37
38 dontUseCmakeConfigure = true;
39
40 postPatch = ''
41 cd python-package
42 '';
43
44 # test setup tries to download test data with no option to disable
45 # (removing sklearn from nativeCheckInputs causes all previously enabled tests to be skipped)
46 # and are extremely cpu intensive anyway
47 doCheck = false;
48
49 pythonImportsCheck = [ "xgboost" ];
50
51 __darwinAllowLocalNetworking = true;
52}