Merge pull request #307098 from r-ryantm/auto-update/cilium-cli
[NixPkgs.git] / pkgs / development / python-modules / lightgbm / default.nix
bloba87276c15f1772160f130bee5a294c75373f742d
1 { lib
2 , config
3 , stdenv
4 , buildPythonPackage
5 , fetchPypi
7 # build-system
8 , cmake
9 , ninja
10 , pathspec
11 , pyproject-metadata
12 , scikit-build-core
14 # dependencies
15 , llvmPackages
16 , numpy
17 , scipy
18 , pythonOlder
20 # optionals
21 , cffi
22 , dask
23 , pandas
24 , pyarrow
25 , scikit-learn
27 # optionals: gpu
28 , boost
29 , ocl-icd
30 , opencl-headers
31 , gpuSupport ? stdenv.isLinux && !cudaSupport
32 , cudaSupport ? config.cudaSupport
33 , cudaPackages
36 assert gpuSupport -> cudaSupport != true;
37 assert cudaSupport -> gpuSupport != true;
39 buildPythonPackage rec {
40   pname = "lightgbm";
41   version = "4.3.0";
42   pyproject = true;
44   disabled = pythonOlder "3.7";
46   src = fetchPypi {
47     inherit pname version;
48     hash = "sha256-AG9XhKm87kPlp+lD3E8C3hui7np68e5fGQ04Pztsnr4=";
49   };
51   nativeBuildInputs = [
52     cmake
53     ninja
54     pathspec
55     pyproject-metadata
56     scikit-build-core
57   ] ++ lib.optionals cudaSupport [
58     cudaPackages.cuda_nvcc
59   ];
61   dontUseCmakeConfigure = true;
63   buildInputs = (lib.optionals stdenv.cc.isClang [
64     llvmPackages.openmp
65   ]) ++ (lib.optionals gpuSupport [
66     boost
67     ocl-icd
68     opencl-headers
69   ]) ++ lib.optionals cudaSupport [
70     cudaPackages.cuda_nvcc
71     cudaPackages.cuda_cudart
72   ];
74   propagatedBuildInputs = [
75     numpy
76     scipy
77   ];
79   pypaBuildFlags = lib.optionals gpuSupport [
80     "--config-setting=cmake.define.USE_GPU=ON"
81   ] ++ lib.optionals cudaSupport [
82     "--config-setting=cmake.define.USE_CUDA=ON"
83   ];
85   postConfigure = ''
86     export HOME=$(mktemp -d)
87   '';
89   passthru.optional-dependencies = {
90     arrow = [
91       cffi
92       pyarrow
93     ];
94     dask = [
95       dask
96       pandas
97     ] ++ dask.optional-dependencies.array
98       ++ dask.optional-dependencies.dataframe
99       ++ dask.optional-dependencies.distributed;
100     pandas = [
101       pandas
102     ];
103     scikit-learn = [
104       scikit-learn
105     ];
106   };
108   # The pypi package doesn't distribute the tests from the GitHub
109   # repository. It contains c++ tests which don't seem to wired up to
110   # `make check`.
111   doCheck = false;
113   pythonImportsCheck = [
114     "lightgbm"
115   ];
117   meta = {
118     description = "A fast, distributed, high performance gradient boosting (GBDT, GBRT, GBM or MART) framework";
119     homepage = "https://github.com/Microsoft/LightGBM";
120     changelog = "https://github.com/microsoft/LightGBM/releases/tag/v${version}";
121     license = lib.licenses.mit;
122     maintainers = with lib.maintainers; [ teh ];
123   };