summary refs log tree commit diff
path: root/pkgs/development/python-modules/catboost
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/python-modules/catboost')
-rw-r--r--pkgs/development/python-modules/catboost/default.nix96
-rw-r--r--pkgs/development/python-modules/catboost/nix-support.patch173
2 files changed, 41 insertions, 228 deletions
diff --git a/pkgs/development/python-modules/catboost/default.nix b/pkgs/development/python-modules/catboost/default.nix
index 1939b7c13a6..840c01d876a 100644
--- a/pkgs/development/python-modules/catboost/default.nix
+++ b/pkgs/development/python-modules/catboost/default.nix
@@ -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.pythonOnBuildForHost.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;
-  };
 }
diff --git a/pkgs/development/python-modules/catboost/nix-support.patch b/pkgs/development/python-modules/catboost/nix-support.patch
deleted file mode 100644
index b8294420e09..00000000000
--- a/pkgs/development/python-modules/catboost/nix-support.patch
+++ /dev/null
@@ -1,173 +0,0 @@
-diff --git a/catboost/python-package/setup.py b/catboost/python-package/setup.py
-index fe9251a21f..86b880c5d0 100644
---- a/catboost/python-package/setup.py
-+++ b/catboost/python-package/setup.py
-@@ -80,7 +80,7 @@ class Helper(object):
-         self.with_cuda = os.environ.get('CUDA_PATH') or os.environ.get('CUDA_ROOT') or None
-         self.os_sdk = 'local'
-         self.with_ymake = True
--        self.parallel = None
-+        self.parallel = os.environ.get('NIX_BUILD_CORES') or None
- 
-     def finalize_options(self):
-         if os.path.exists(str(self.with_cuda)):
-@@ -222,11 +222,12 @@ class build_ext(_build_ext):
- 
-     def build_with_make(self, topsrc_dir, build_dir, catboost_ext, put_dir, verbose, dry_run):
-         logging.info('Buildling {} with gnu make'.format(catboost_ext))
--        makefile = 'python{}.{}CLANG11-LINUX-X86_64.makefile'.format(python_version()[0], 'CUDA.' if self.with_cuda else '')
-+        makefile = 'python{}.{}CLANG12-LINUX-X86_64.makefile'.format(python_version()[0], 'CUDA.' if self.with_cuda else '')
-         make_cmd = [
-             'make', '-f', '../../make/' + makefile,
--            'CC=clang-11',
--            'CXX=clang++-11',
-+            'CC=clang',
-+            'CXX=clang++',
-+            'PYTHON=python{}'.format(python_version()[0]),
-             'BUILD_ROOT=' + build_dir,
-             'SOURCE_ROOT=' + topsrc_dir,
-         ]
-diff --git a/make/python2.CLANG12-LINUX-X86_64.makefile b/make/python2.CLANG12-LINUX-X86_64.makefile
-index b49a36fb3f..33996af995 100644
---- a/make/python2.CLANG12-LINUX-X86_64.makefile
-+++ b/make/python2.CLANG12-LINUX-X86_64.makefile
-@@ -4,31 +4,6 @@ BUILD_ROOT = $(shell pwd)
- SOURCE_ROOT = $(shell pwd)
- PYTHON = $(shell which python)
- 
--ifneq ($(MAKECMDGOALS),help)
--define _CC_TEST
--__clang_major__ __clang_minor__
--endef
--
--_CC_VERSION = $(shell echo '$(_CC_TEST)' | $(CC) -E -P -)
--$(info _CC_VERSION = '$(_CC_VERSION)')
--
--ifneq '$(_CC_VERSION)' '12 0'
--    $(error clang 12.0 is required)
--endif
--endif
--
--ifneq ($(MAKECMDGOALS),help)
--define _CXX_TEST
--__clang_major__ __clang_minor__
--endef
--
--_CXX_VERSION = $(shell echo '$(_CXX_TEST)' | $(CXX) -E -P -)
--$(info _CXX_VERSION = '$(_CXX_VERSION)')
--
--ifneq '$(_CXX_VERSION)' '12 0'
--    $(error clang 12.0 is required)
--endif
--endif
- 
- 
- all\
-diff --git a/make/python2.CUDA.CLANG12-LINUX-X86_64.makefile b/make/python2.CUDA.CLANG12-LINUX-X86_64.makefile
-index 82935b297e..093cc86532 100644
---- a/make/python2.CUDA.CLANG12-LINUX-X86_64.makefile
-+++ b/make/python2.CUDA.CLANG12-LINUX-X86_64.makefile
-@@ -4,31 +4,6 @@ BUILD_ROOT = $(shell pwd)
- SOURCE_ROOT = $(shell pwd)
- PYTHON = $(shell which python)
- 
--ifneq ($(MAKECMDGOALS),help)
--define _CC_TEST
--__clang_major__ __clang_minor__
--endef
--
--_CC_VERSION = $(shell echo '$(_CC_TEST)' | $(CC) -E -P -)
--$(info _CC_VERSION = '$(_CC_VERSION)')
--
--ifneq '$(_CC_VERSION)' '12 0'
--    $(error clang 12.0 is required)
--endif
--endif
--
--ifneq ($(MAKECMDGOALS),help)
--define _CXX_TEST
--__clang_major__ __clang_minor__
--endef
--
--_CXX_VERSION = $(shell echo '$(_CXX_TEST)' | $(CXX) -E -P -)
--$(info _CXX_VERSION = '$(_CXX_VERSION)')
--
--ifneq '$(_CXX_VERSION)' '12 0'
--    $(error clang 12.0 is required)
--endif
--endif
- 
- 
- all\
-diff --git a/make/python3.CLANG12-LINUX-X86_64.makefile b/make/python3.CLANG12-LINUX-X86_64.makefile
-index 1c5d646ae4..6c091fbe17 100644
---- a/make/python3.CLANG12-LINUX-X86_64.makefile
-+++ b/make/python3.CLANG12-LINUX-X86_64.makefile
-@@ -4,31 +4,6 @@ BUILD_ROOT = $(shell pwd)
- SOURCE_ROOT = $(shell pwd)
- PYTHON = $(shell which python)
- 
--ifneq ($(MAKECMDGOALS),help)
--define _CC_TEST
--__clang_major__ __clang_minor__
--endef
--
--_CC_VERSION = $(shell echo '$(_CC_TEST)' | $(CC) -E -P -)
--$(info _CC_VERSION = '$(_CC_VERSION)')
--
--ifneq '$(_CC_VERSION)' '12 0'
--    $(error clang 12.0 is required)
--endif
--endif
--
--ifneq ($(MAKECMDGOALS),help)
--define _CXX_TEST
--__clang_major__ __clang_minor__
--endef
--
--_CXX_VERSION = $(shell echo '$(_CXX_TEST)' | $(CXX) -E -P -)
--$(info _CXX_VERSION = '$(_CXX_VERSION)')
--
--ifneq '$(_CXX_VERSION)' '12 0'
--    $(error clang 12.0 is required)
--endif
--endif
- 
- 
- all\
-diff --git a/make/python3.CUDA.CLANG12-LINUX-X86_64.makefile b/make/python3.CUDA.CLANG12-LINUX-X86_64.makefile
-index fcdb75a719..4e1dbc3cd7 100644
---- a/make/python3.CUDA.CLANG12-LINUX-X86_64.makefile
-+++ b/make/python3.CUDA.CLANG12-LINUX-X86_64.makefile
-@@ -4,31 +4,6 @@ BUILD_ROOT = $(shell pwd)
- SOURCE_ROOT = $(shell pwd)
- PYTHON = $(shell which python)
- 
--ifneq ($(MAKECMDGOALS),help)
--define _CC_TEST
--__clang_major__ __clang_minor__
--endef
--
--_CC_VERSION = $(shell echo '$(_CC_TEST)' | $(CC) -E -P -)
--$(info _CC_VERSION = '$(_CC_VERSION)')
--
--ifneq '$(_CC_VERSION)' '12 0'
--    $(error clang 12.0 is required)
--endif
--endif
--
--ifneq ($(MAKECMDGOALS),help)
--define _CXX_TEST
--__clang_major__ __clang_minor__
--endef
--
--_CXX_VERSION = $(shell echo '$(_CXX_TEST)' | $(CXX) -E -P -)
--$(info _CXX_VERSION = '$(_CXX_VERSION)')
--
--ifneq '$(_CXX_VERSION)' '12 0'
--    $(error clang 12.0 is required)
--endif
--endif
- 
- 
- all\