depot/third_party/nixpkgs/pkgs/development/python-modules/xgboost/default.nix
Default email f34ce41345 Project import generated by Copybara.
GitOrigin-RevId: b73c2221a46c13557b1b3be9c2070cc42cf01eb3
2024-07-27 08:49:29 +02:00

52 lines
1.1 KiB
Nix

{
buildPythonPackage,
pythonOlder,
cmake,
numpy,
scipy,
hatchling,
stdenv,
xgboost,
}:
buildPythonPackage {
pname = "xgboost";
format = "pyproject";
inherit (xgboost) version src meta;
disabled = pythonOlder "3.8";
nativeBuildInputs = [
cmake
hatchling
];
buildInputs = [ xgboost ];
propagatedBuildInputs = [
numpy
scipy
];
# 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
'';
dontUseCmakeConfigure = true;
postPatch = ''
cd python-package
'';
# test setup tries to download test data with no option to disable
# (removing sklearn from nativeCheckInputs causes all previously enabled tests to be skipped)
# and are extremely cpu intensive anyway
doCheck = false;
pythonImportsCheck = [ "xgboost" ];
__darwinAllowLocalNetworking = true;
}