Skip to content

Commit

Permalink
python310Packages.catboost: 1.0.5 -> 1.2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
natsukium committed Sep 28, 2023
1 parent 08b7a46 commit fc84d02
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 229 deletions.
96 changes: 41 additions & 55 deletions pkgs/development/python-modules/catboost/default.nix
Original file line number Diff line number Diff line change
@@ -1,64 +1,50 @@
{ buildPythonPackage, fetchFromGitHub, lib, pythonOlder
, clang_12, python
, graphviz, matplotlib, numpy, pandas, plotly, scipy, six
, withCuda ? false, cudatoolkit }:

buildPythonPackage rec {
pname = "catboost";
# nixpkgs-update: no auto update
version = "1.0.5";

disabled = pythonOlder "3.4";
{ lib
, buildPythonPackage
, catboost
, python
, graphviz
, matplotlib
, numpy
, pandas
, plotly
, scipy
, setuptools
, six
, wheel
}:

buildPythonPackage {
inherit (catboost) pname version src meta;
format = "pyproject";

sourceRoot = "source/catboost/python-package";

nativeBuildInputs = [
setuptools
wheel
];

src = fetchFromGitHub {
owner = "catboost";
repo = "catboost";
rev = "refs/tags/v${version}";
hash = "sha256-ILemeZUBI9jPb9G6F7QX/T1HaVhQ+g6y7YmsT6DFCJk";
};
propagatedBuildInputs = [
graphviz
matplotlib
numpy
pandas
plotly
scipy
six
];

nativeBuildInputs = [ clang_12 ];
buildPhase = ''
runHook preBuild
propagatedBuildInputs = [ graphviz matplotlib numpy pandas scipy plotly six ]
++ lib.optionals withCuda [ cudatoolkit ];
# these arguments must set after bdist_wheel
${python.pythonForBuild.interpreter} setup.py bdist_wheel --no-widget --prebuilt-extensions-build-root-dir=${lib.getDev catboost}
patches = [
./nix-support.patch
];

postPatch = ''
# substituteInPlace is too slow for these large files, and the target has lots of numbers in it that change often.
sed -e 's|\$(YMAKE_PYTHON3-.*)/python3|${python.interpreter}|' -i make/*.makefile
runHook postBuild
'';

preBuild = ''
cd catboost/python-package
'';
setupPyBuildFlags = [ "--with-ymake=no" ];
CUDA_ROOT = lib.optional withCuda cudatoolkit;
enableParallelBuilding = true;
# setup a test is difficult
doCheck = false;

# Tests use custom "ya" tool, not yet supported.
dontUseSetuptoolsCheck = true;
pythonImportsCheck = [ "catboost" ];

passthru = {
# Do not update to catboost 1.1.x because the patch doesn't apply cleanly
skipBulkUpdate = true;
};

meta = with lib; {
description = "High-performance library for gradient boosting on decision trees.";
longDescription = ''
A fast, scalable, high performance Gradient Boosting on Decision Trees
library, used for ranking, classification, regression and other machine
learning tasks for Python, R, Java, C++. Supports computation on CPU and GPU.
'';
license = licenses.asl20;
platforms = [ "x86_64-linux" ];
homepage = "https://catboost.ai";
maintainers = with maintainers; [ PlushBeaver ];
# _catboost.pyx.cpp:226822:19: error: use of undeclared identifier '_PyGen_Send'
broken = withCuda;
};
}
173 changes: 0 additions & 173 deletions pkgs/development/python-modules/catboost/nix-support.patch

This file was deleted.

7 changes: 6 additions & 1 deletion pkgs/top-level/python-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -1769,7 +1769,12 @@ self: super: with self; {

catalogue = callPackage ../development/python-modules/catalogue { };

catboost = callPackage ../development/python-modules/catboost { };
catboost = callPackage ../development/python-modules/catboost {
catboost = pkgs.catboost.override {
pythonSupport = true;
python3Packages = self;
};
};

catppuccin = callPackage ../development/python-modules/catppuccin { };

Expand Down

0 comments on commit fc84d02

Please sign in to comment.