summaryrefslogtreecommitdiffstats
path: root/pkgs/development/python-modules/catboost/default.nix
blob: 4a751fbd639ea87e4096f180e2a1dddd24b0a8e3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
{
  lib,
  buildPythonPackage,
  catboost,
  python,

  # build-system
  cmake,
  cython,
  setuptools,

  # dependencies
  graphviz,
  matplotlib,
  numpy,
  pandas,
  plotly,
  scipy,
  six,
}:

buildPythonPackage rec {
  inherit (catboost)
    pname
    version
    src
    ;
  pyproject = true;

  sourceRoot = "${src.name}/catboost/python-package";

  build-system = [
    cmake
    cython
    setuptools
  ];

  dependencies = [
    graphviz
    matplotlib
    numpy
    pandas
    plotly
    scipy
    six
  ];

  postPatch = ''
    substituteInPlace setup.py \
      --replace-fail "cmake (>=3.24, <4.0)" "cmake" \
      --replace-fail "'conan (>=2.4.1, <3.0)', " "" \
      --replace-fail "cython ~= 3.0.10" "cython"
  '';

  dontConfigure = true;

  buildPhase = ''
    runHook preBuild

    # these arguments must set after bdist_wheel
    ${python.pythonOnBuildForHost.interpreter} setup.py bdist_wheel --no-widget --prebuilt-extensions-build-root-dir=${lib.getDev catboost}

    runHook postBuild
  '';

  # setup a test is difficult
  doCheck = false;

  pythonImportsCheck = [ "catboost" ];

  meta = catboost.meta;
}