From patchwork Mon Jun 26 01:06:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vinicius Monego X-Patchwork-Id: 51345 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 72F5127BBE9; Mon, 26 Jun 2023 02:08:20 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 3DA9627BBE2 for ; Mon, 26 Jun 2023 02:08:18 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qDai4-0007l8-TW; Sun, 25 Jun 2023 21:08:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qDai3-0007kr-43 for guix-patches@gnu.org; Sun, 25 Jun 2023 21:08:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qDai2-0004db-RR for guix-patches@gnu.org; Sun, 25 Jun 2023 21:08:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qDai2-0004fJ-Mz for guix-patches@gnu.org; Sun, 25 Jun 2023 21:08:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#48785] [PATCH v6 3/3] gnu: Add python-lightgbm. Resent-From: Vinicius Monego Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 26 Jun 2023 01:08:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 48785 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 48785@debbugs.gnu.org Cc: Vinicius Monego Received: via spool by 48785-submit@debbugs.gnu.org id=B48785.168774166417892 (code B ref 48785); Mon, 26 Jun 2023 01:08:02 +0000 Received: (at 48785) by debbugs.gnu.org; 26 Jun 2023 01:07:44 +0000 Received: from localhost ([127.0.0.1]:44027 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qDahk-0004eV-4u for submit@debbugs.gnu.org; Sun, 25 Jun 2023 21:07:44 -0400 Received: from mout02.posteo.de ([185.67.36.66]:35933) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qDahh-0004e6-Pd for 48785@debbugs.gnu.org; Sun, 25 Jun 2023 21:07:42 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 0FD8D240101 for <48785@debbugs.gnu.org>; Mon, 26 Jun 2023 03:07:36 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1687741656; bh=S+xWvyBJjg2cVGsH9kacXcLqQ2lWfEsqC8TqrPl4Q9g=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version: Content-Transfer-Encoding:From; b=CA2e7bHqDUI1t8WJJ1cTdeWUnFgjIzlcDh/NjI5PsA4D4YydtT+txeK3udI8xCRtg ARuMEqQB0WQ5TEH0cdtWiyHUcREutbffoylW7UEhIJfHAnAe9umXr2F6/TKE00klAl RScSw/Df8D6yuZyoIgC18LUCgQA8xsoHJQhmmBBAzAmoMShPjz4ZgLTuesvcAWVkna sDBAPzfuaohDyB1VBnKf0oFV6uVpcDt4vHN+wZdDKTHZMXZfzC7q4DC9lZGkfhjj22 kCBPWl8RH2d/qo6lN0o4xT6Sl0eq022WP6u3CEJ/D/2ME8Ryn7MNObPQsSky9i2Ru4 3reFBFAbkM3Aw== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4Qq8pG337zz6txw; Mon, 26 Jun 2023 03:07:34 +0200 (CEST) From: Vinicius Monego Date: Mon, 26 Jun 2023 01:06:35 +0000 Message-Id: <20230626010635.129221-3-monego@posteo.net> In-Reply-To: <20230626010635.129221-1-monego@posteo.net> References: <20230626010635.129221-1-monego@posteo.net> MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * gnu/packages/machine-learning.scm (python-lightgbm): New variable. --- Removed symlinks in favor of substituting lib_path. gnu/packages/machine-learning.scm | 39 +++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/gnu/packages/machine-learning.scm b/gnu/packages/machine-learning.scm index 17de467f46..bba89d789d 100644 --- a/gnu/packages/machine-learning.scm +++ b/gnu/packages/machine-learning.scm @@ -1839,6 +1839,45 @@ (define-public lightgbm @end itemize\n") (license license:expat))) +(define-public python-lightgbm + (package + (inherit lightgbm) + (name "python-lightgbm") + (source (package-source lightgbm)) + (build-system python-build-system) + (arguments + (list #:configure-flags #~(list "--precompile") ; use our library + #:phases + #~(modify-phases %standard-phases + (add-after 'unpack 'preparations + (lambda _ + (setenv "HOME" "/tmp") ; to write a log file + (rename-file "python-package/setup.py" "setup.py") + (rename-file "python-package/README.rst" "README.rst") + (rename-file "python-package/lightgbm" "lightgbm") + ;; Write the version so the module identifies it. + (with-output-to-file "lightgbm/VERSION.txt" + (lambda () (display #$(package-version lightgbm)))) + ;; Manually install the lib. + (substitute* "setup.py" + (("'install_lib': CustomInstallLib,") "")) + ;; Change lib_path to look for our package's lib. + (substitute* "lightgbm/libpath.py" + (("lib_path = \\[str\\(p\\) for p in dll_path if p\\.is_file\\(\\)]") + ;; lib_path is a list of paths. + (format #f "lib_path = ['~a/lib/lib_lightgbm.so']" + #$(this-package-input "lightgbm")))))) + (replace 'check + (lambda* (#:key tests? #:allow-other-keys) + (when tests? + (invoke "python" "-m" "pytest" + "tests/python_package_test"))))))) + (native-inputs (list python-psutil python-pytest python-wheel)) + (inputs (list lightgbm)) + (propagated-inputs (list python-numpy python-pandas python-scikit-learn + python-scipy)) + (synopsis "Python interface for LightGBM"))) + (define-public vowpal-wabbit ;; Language bindings not included. (package