From 1e70c4fd41372ac3f439f0515ac6d91225365122 Mon Sep 17 00:00:00 2001 From: Dmitry Kozlyuk Date: Sat, 2 Jan 2021 14:26:33 +0300 Subject: [PATCH 1/2] maintainers: add PlushBeaver --- maintainers/maintainer-list.nix | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/maintainers/maintainer-list.nix b/maintainers/maintainer-list.nix index 07b231f175f8..072feb576ec8 100644 --- a/maintainers/maintainer-list.nix +++ b/maintainers/maintainer-list.nix @@ -7125,6 +7125,12 @@ githubId = 13000278; name = "Maksim Bronsky"; }; + PlushBeaver = { + name = "Dmitry Kozlyuk"; + email = "dmitry.kozliuk+nixpkgs@gmail.com"; + github = "PlushBeaver"; + githubId = 8988269; + }; pmahoney = { email = "pat@polycrystal.org"; github = "pmahoney"; From ef19c4d18174143896be418ad34de924dde376c6 Mon Sep 17 00:00:00 2001 From: Dmitry Kozlyuk Date: Sat, 2 Jan 2021 14:31:36 +0300 Subject: [PATCH 2/2] catboost: init at 0.24.4 --- .../python-modules/catboost/default.nix | 56 ++++++ .../python-modules/catboost/nix-support.patch | 181 ++++++++++++++++++ pkgs/top-level/python-packages.nix | 2 + 3 files changed, 239 insertions(+) create mode 100644 pkgs/development/python-modules/catboost/default.nix create mode 100644 pkgs/development/python-modules/catboost/nix-support.patch diff --git a/pkgs/development/python-modules/catboost/default.nix b/pkgs/development/python-modules/catboost/default.nix new file mode 100644 index 000000000000..8c5184240f62 --- /dev/null +++ b/pkgs/development/python-modules/catboost/default.nix @@ -0,0 +1,56 @@ +{ buildPythonPackage, fetchFromGitHub, fetchpatch, lib, pythonOlder +, clang_7, python2 +, graphviz, matplotlib, numpy, pandas, plotly, scipy, six +, withCuda ? false, cudatoolkit }: + +buildPythonPackage rec { + pname = "catboost"; + version = "0.24.4"; + + disabled = pythonOlder "3.4"; + + src = fetchFromGitHub { + owner = "catboost"; + repo = "catboost"; + rev = "v${version}"; + sha256 = "sha256-pzmwEiKziB4ldnKgeCsP2HdnisX8sOkLssAzNfcSEx8="; + }; + + nativeBuildInputs = [ clang_7 python2 ]; + + propagatedBuildInputs = [ graphviz matplotlib numpy pandas scipy plotly six ] + ++ lib.optional withCuda [ cudatoolkit ]; + + patches = [ + ./nix-support.patch + (fetchpatch { + name = "format.patch"; + url = "https://github.com/catboost/catboost/pull/1528/commits/a692ba42e5c0f62e5da82b2f6fccfa77deb3419c.patch"; + sha256 = "sha256-fNGucHxsSDFRLk3hFH7rm+zzTdDpY9/QjRs8K+AzVvo="; + }) + ]; + + preBuild = '' + cd catboost/python-package + ''; + setupPyBuildFlags = [ "--with-ymake=no" ]; + CUDA_ROOT = lib.optional withCuda cudatoolkit; + enableParallelBuilding = true; + + # Tests use custom "ya" tool, not yet supported. + dontUseSetuptoolsCheck = true; + pythonImportsCheck = [ "catboost" ]; + + 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 ]; + }; +} diff --git a/pkgs/development/python-modules/catboost/nix-support.patch b/pkgs/development/python-modules/catboost/nix-support.patch new file mode 100644 index 000000000000..feaf97d57070 --- /dev/null +++ b/pkgs/development/python-modules/catboost/nix-support.patch @@ -0,0 +1,181 @@ +diff --git a/catboost/python-package/setup.py b/catboost/python-package/setup.py +index 17f1d8ff14..07da618cd1 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{}.{}CLANG50-LINUX-X86_64.makefile'.format(python_version()[0], 'CUDA.' if self.with_cuda else '') ++ makefile = 'python{}.{}CLANG7-LINUX-X86_64.makefile'.format(python_version()[0], 'CUDA.' if self.with_cuda else '') + make_cmd = [ + 'make', '-f', '../../make/' + makefile, +- 'CC=clang-5.0', +- 'CXX=clang++-5.0', ++ 'CC=clang', ++ 'CXX=clang++', ++ 'PYTHON=python2', + 'BUILD_ROOT=' + build_dir, + 'SOURCE_ROOT=' + topsrc_dir, + ] +diff --git a/make/python2.CLANG7-LINUX-X86_64.makefile b/make/python2.CLANG7-LINUX-X86_64.makefile +index e54b7078e8..fb7b208af9 100644 +--- a/make/python2.CLANG7-LINUX-X86_64.makefile ++++ b/make/python2.CLANG7-LINUX-X86_64.makefile +@@ -4,33 +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)' '7 0' +- $(error clang 7.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)' '7 0' +- $(error clang 7.0 is required) +-endif +-endif +- +- + all\ + ::\ + $(BUILD_ROOT)/catboost/python-package/catboost/_catboost.so\ +diff --git a/make/python2.CUDA.CLANG7-LINUX-X86_64.makefile b/make/python2.CUDA.CLANG7-LINUX-X86_64.makefile +index 2a22a79b25..522fb54a7c 100644 +--- a/make/python2.CUDA.CLANG7-LINUX-X86_64.makefile ++++ b/make/python2.CUDA.CLANG7-LINUX-X86_64.makefile +@@ -4,33 +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)' '7 0' +- $(error clang 7.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)' '7 0' +- $(error clang 7.0 is required) +-endif +-endif +- +- + all\ + ::\ + $(BUILD_ROOT)/catboost/python-package/catboost/_catboost.so\ +diff --git a/make/python3.CLANG7-LINUX-X86_64.makefile b/make/python3.CLANG7-LINUX-X86_64.makefile +index fee6750bcb..dc55908371 100644 +--- a/make/python3.CLANG7-LINUX-X86_64.makefile ++++ b/make/python3.CLANG7-LINUX-X86_64.makefile +@@ -4,33 +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)' '7 0' +- $(error clang 7.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)' '7 0' +- $(error clang 7.0 is required) +-endif +-endif +- +- + all\ + ::\ + $(BUILD_ROOT)/catboost/python-package/catboost/_catboost.so\ +diff --git a/make/python3.CUDA.CLANG7-LINUX-X86_64.makefile b/make/python3.CUDA.CLANG7-LINUX-X86_64.makefile +index 5146830476..ff8535b03e 100644 +--- a/make/python3.CUDA.CLANG7-LINUX-X86_64.makefile ++++ b/make/python3.CUDA.CLANG7-LINUX-X86_64.makefile +@@ -4,33 +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)' '7 0' +- $(error clang 7.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)' '7 0' +- $(error clang 7.0 is required) +-endif +-endif +- +- + all\ + ::\ + $(BUILD_ROOT)/catboost/python-package/catboost/_catboost.so\ diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 64652bb430f7..30087acdb88a 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -1135,6 +1135,8 @@ in { catalogue = callPackage ../development/python-modules/catalogue { }; + catboost = callPackage ../development/python-modules/catboost { }; + cbeams = callPackage ../misc/cbeams { }; cbor2 = callPackage ../development/python-modules/cbor2 { };