1{ buildPythonPackage, fetchFromGitHub, fetchpatch, lib, pythonOlder
2, clang_7, python2
3, graphviz, matplotlib, numpy, pandas, plotly, scipy, six
4, withCuda ? false, cudatoolkit }:
5
6buildPythonPackage rec {
7 pname = "catboost";
8 version = "0.24.4";
9
10 disabled = pythonOlder "3.4";
11
12 src = fetchFromGitHub {
13 owner = "catboost";
14 repo = "catboost";
15 rev = "v${version}";
16 sha256 = "sha256-pzmwEiKziB4ldnKgeCsP2HdnisX8sOkLssAzNfcSEx8=";
17 };
18
19 nativeBuildInputs = [ clang_7 python2 ];
20
21 propagatedBuildInputs = [ graphviz matplotlib numpy pandas scipy plotly six ]
22 ++ lib.optional withCuda [ cudatoolkit ];
23
24 patches = [
25 ./nix-support.patch
26 (fetchpatch {
27 name = "format.patch";
28 url = "https://github.com/catboost/catboost/pull/1528/commits/a692ba42e5c0f62e5da82b2f6fccfa77deb3419c.patch";
29 sha256 = "sha256-fNGucHxsSDFRLk3hFH7rm+zzTdDpY9/QjRs8K+AzVvo=";
30 })
31 ];
32
33 preBuild = ''
34 cd catboost/python-package
35 '';
36 setupPyBuildFlags = [ "--with-ymake=no" ];
37 CUDA_ROOT = lib.optional withCuda cudatoolkit;
38 enableParallelBuilding = true;
39
40 # Tests use custom "ya" tool, not yet supported.
41 dontUseSetuptoolsCheck = true;
42 pythonImportsCheck = [ "catboost" ];
43
44 meta = with lib; {
45 description = "High-performance library for gradient boosting on decision trees.";
46 longDescription = ''
47 A fast, scalable, high performance Gradient Boosting on Decision Trees
48 library, used for ranking, classification, regression and other machine
49 learning tasks for Python, R, Java, C++. Supports computation on CPU and GPU.
50 '';
51 license = licenses.asl20;
52 platforms = [ "x86_64-linux" ];
53 homepage = "https://catboost.ai";
54 maintainers = with maintainers; [ PlushBeaver ];
55 };
56}