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