all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Vinicius Monego <monego@posteo.net>
To: 48785@debbugs.gnu.org
Cc: Vinicius Monego <monego@posteo.net>
Subject: [bug#48785] [PATCH v6 3/3] gnu: Add python-lightgbm.
Date: Mon, 26 Jun 2023 01:06:35 +0000	[thread overview]
Message-ID: <20230626010635.129221-3-monego@posteo.net> (raw)
In-Reply-To: <20230626010635.129221-1-monego@posteo.net>

* 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
-- 
2.34.1





      parent reply	other threads:[~2023-06-26  1:08 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-01 22:05 [bug#48785] [PATCH 0/3] Update LightGBM and split frontends Vinicius Monego
2021-06-01 22:06 ` [bug#48785] [PATCH 1/3] gnu: Add fast-double-parser Vinicius Monego
2021-06-01 22:06   ` [bug#48785] [PATCH 2/3] gnu: lightgbm: Update to 3.2.1 Vinicius Monego
2021-06-01 22:06   ` [bug#48785] [PATCH 3/3] gnu: Add python-lightgbm Vinicius Monego
2021-06-30 20:09 ` [bug#48785] [PATCH v2 1/3] gnu: Add fast-double-parser Vinicius Monego
2021-06-30 20:09   ` [bug#48785] [PATCH v2 2/3] gnu: lightgbm: Update to 3.2.1 Vinicius Monego
2021-06-30 20:09   ` [bug#48785] [PATCH v2 3/3] gnu: Add python-lightgbm Vinicius Monego
2021-10-08  2:54 ` [bug#48785] [PATCH v3 1/3] gnu: Add fast-double-parser Vinicius Monego
2021-10-08  2:54   ` [bug#48785] [PATCH v3 2/3] gnu: lightgbm: Update to 3.2.1 Vinicius Monego
2021-10-08  2:54   ` [bug#48785] [PATCH v3 3/3] gnu: Add python-lightgbm Vinicius Monego
2021-10-31  1:40 ` [bug#48785] [PATCH v4 1/3] gnu: Add fast-double-parser Vinicius Monego
2021-10-31  1:40   ` [bug#48785] [PATCH v4 2/3] gnu: lightgbm: Update to 3.3.1 Vinicius Monego
2021-10-31  1:40   ` [bug#48785] [PATCH v4 3/3] gnu: Add python-lightgbm Vinicius Monego
2023-04-07 15:17 ` [bug#48785] [PATCH v5 1/3] gnu: Add fast-double-parser Vinicius Monego
2023-04-07 15:17   ` [bug#48785] [PATCH v5 2/3] gnu: lightgbm: Update to 3.3.5 Vinicius Monego
2023-04-07 15:17   ` [bug#48785] [PATCH v5 3/3] gnu: Add python-lightgbm Vinicius Monego
2023-06-26  1:06 ` [bug#48785] [PATCH v6 1/3] gnu: Add fast-double-parser Vinicius Monego
2023-06-26  1:06   ` [bug#48785] [PATCH v6 2/3] gnu: lightgbm: Update to 3.3.5 Vinicius Monego
2023-06-26  1:06   ` Vinicius Monego [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230626010635.129221-3-monego@posteo.net \
    --to=monego@posteo.net \
    --cc=48785@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.