guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

15/64: gnu: Add python-clarabel.


From: guix-commits
Subject: 15/64: gnu: Add python-clarabel.
Date: Thu, 2 May 2024 10:52:23 -0400 (EDT)

rekado pushed a commit to branch wip-python-team
in repository guix.

commit 8f879ccd869ac11846215009be934940ee2aee2e
Author: Ricardo Wurmus <rekado@elephly.net>
AuthorDate: Mon Apr 29 12:31:13 2024 +0200

    gnu: Add python-clarabel.
    
    * gnu/packages/python-science.scm (python-clarabel): New variable.
    
    Change-Id: I28459162460ca9bf9e9557122f611c677afadc27
---
 gnu/local.mk                                    |  1 +
 gnu/packages/patches/python-clarabel-blas.patch | 38 ++++++++++++++++
 gnu/packages/python-science.scm                 | 59 +++++++++++++++++++++++++
 3 files changed, 98 insertions(+)

diff --git a/gnu/local.mk b/gnu/local.mk
index 531c06627c..c9dda00885 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1823,6 +1823,7 @@ dist_patch_DATA =                                         
\
   %D%/packages/patches/python-accupy-use-matplotx.patch                \
   %D%/packages/patches/python-accupy-fix-use-of-perfplot.patch \
   %D%/packages/patches/python-chai-drop-python2.patch          \
+  %D%/packages/patches/python-clarabel-blas.patch              \
   %D%/packages/patches/python-docrepr-fix-tests.patch          \
   %D%/packages/patches/python-feedparser-missing-import.patch  \
   %D%/packages/patches/python-louvain-fix-test.patch           \
diff --git a/gnu/packages/patches/python-clarabel-blas.patch 
b/gnu/packages/patches/python-clarabel-blas.patch
new file mode 100644
index 0000000000..bd88a2171b
--- /dev/null
+++ b/gnu/packages/patches/python-clarabel-blas.patch
@@ -0,0 +1,38 @@
+Ensure that no feature set refers to blas-src or lapack-src, because we want
+to just use the existing openblas library.
+
+--- a/Cargo.toml       2024-04-24 14:13:23.519997967 +0200
++++ b/Cargo.toml       2024-04-24 14:13:09.983966101 +0200
+@@ -34,11 +34,11 @@
+ sdp = ["blas","lapack"]
+ 
+ # explicit configuration options for different blas flavours
+-sdp-accelerate = ["sdp", "blas-src/accelerate", "lapack-src/accelerate"]
+-sdp-netlib     = ["sdp", "blas-src/netlib", "lapack-src/netlib"]
+-sdp-openblas   = ["sdp", "blas-src/openblas", "lapack-src/openblas"]
+-sdp-mkl        = ["sdp", "blas-src/intel-mkl", "lapack-src/intel-mkl"]
+-sdp-r          = ["sdp", "blas-src/r", "lapack-src/r"]
++sdp-accelerate = ["sdp"]
++sdp-netlib     = ["sdp"]
++sdp-openblas   = ["sdp"]
++sdp-mkl        = ["sdp"]
++sdp-r          = ["sdp"]
+ 
+ # build as the julia interface 
+ julia = ["sdp", "dep:libc", "dep:num-derive", "dep:serde", "dep:serde_json"] 
+@@ -62,15 +62,6 @@
+ version = "0.19.0"
+ optional = true
+ 
+-[dependencies.blas-src]
+-version = "0.9"
+-optional = true 
+-
+-[dependencies.lapack-src]
+-version = "0.9"
+-optional = true 
+-
+-
+ # -------------------------------
+ # examples
+ # -------------------------------
diff --git a/gnu/packages/python-science.scm b/gnu/packages/python-science.scm
index e3f182de47..b485a2ecd8 100644
--- a/gnu/packages/python-science.scm
+++ b/gnu/packages/python-science.scm
@@ -50,6 +50,7 @@
   #:use-module (gnu packages check)
   #:use-module (gnu packages chemistry)
   #:use-module (gnu packages cpp)
+  #:use-module (gnu packages crates-io)
   #:use-module (gnu packages crypto)
   #:use-module (gnu packages databases)
   #:use-module (gnu packages digest)
@@ -69,6 +70,7 @@
   #:use-module (gnu packages python-check)
   #:use-module (gnu packages python-web)
   #:use-module (gnu packages python-xyz)
+  #:use-module (gnu packages rust-apps)
   #:use-module (gnu packages simulation)
   #:use-module (gnu packages sphinx)
   #:use-module (gnu packages statistics)
@@ -81,6 +83,7 @@
   #:use-module (guix download)
   #:use-module (guix git-download)
   #:use-module (guix utils)
+  #:use-module (guix build-system cargo)
   #:use-module (guix build-system python)
   #:use-module (guix build-system pyproject))
 
@@ -2378,6 +2381,62 @@ build applications with traitlets in combination with 
the scipy stack.")
 specification and test suite in Python.")
     (license license:expat)))
 
+(define-public python-clarabel
+  (package
+    (name "python-clarabel")
+    (version "0.7.1")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "clarabel" version))
+       (sha256
+        (base32 "15k32ynvh45n9q905bxwamh5w5cia9bxzmwz69wbribmyhsv22m3"))
+       (patches
+        (search-patches "python-clarabel-blas.patch"))))
+    (build-system cargo-build-system)
+    (arguments
+     (list
+      #:imported-modules `(,@%cargo-build-system-modules
+                           ,@%pyproject-build-system-modules)
+      #:modules '((guix build cargo-build-system)
+                  ((guix build pyproject-build-system) #:prefix py:)
+                  (guix build utils))
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'prepare-python-module 'build-python-module
+            (assoc-ref py:%standard-phases 'build))
+          (add-after 'build-python-module 'install-python-module
+            (assoc-ref py:%standard-phases 'install)))
+      #:cargo-inputs
+      `(("rust-amd" ,rust-amd-0.2)
+        ("rust-blas" ,rust-blas-0.22)
+        ("rust-cfg-if" ,rust-cfg-if-1)
+        ("rust-derive-builder" ,rust-derive-builder-0.11)
+        ("rust-enum-dispatch" ,rust-enum-dispatch-0.3) ;0.3.8
+        ("rust-itertools" ,rust-itertools-0.11)
+        ("rust-lapack" ,rust-lapack-0.19)
+        ("rust-lazy-static" ,rust-lazy-static-1) ;1.4
+        ("rust-libc" ,rust-libc-0.2)
+        ("rust-num-derive" ,rust-num-derive-0.2)
+        ("rust-num-traits" ,rust-num-traits-0.2)
+        ("rust-pyo3" ,rust-pyo3-0.20)
+        ("rust-serde" ,rust-serde-1)
+        ("rust-serde-json" ,rust-serde-json-1)
+        ("rust-thiserror" ,rust-thiserror-1))
+      #:features '(list "python")
+      #:install-source? #false))
+    (inputs
+     (list maturin))
+    (native-inputs
+     (list python-wrapper))
+    (propagated-inputs (list python-numpy python-scipy))
+    (home-page "https://github.com/oxfordcontrol/Clarabel.rs";)
+    (synopsis "Interior-point solver for convex conic optimisation problems")
+    (description "Clarabel.rs is a Rust implementation of an interior point
+numerical solver for convex optimization problems using a novel homogeneous
+embedding.")
+    (license license:asl2.0)))
+
 (define-public python-climin
   (package
     (name "python-climin")



reply via email to

[Prev in Thread] Current Thread [Next in Thread]