gnu: Add python-clarabel.

* gnu/packages/python-science.scm (python-clarabel): New variable.

Change-Id: I28459162460ca9bf9e9557122f611c677afadc27
This commit is contained in:
Ricardo Wurmus 2024-04-29 12:31:13 +02:00
parent 94ea83d9ef
commit c4eccd2066
No known key found for this signature in database
GPG key ID: 197A5888235FACAC
3 changed files with 98 additions and 0 deletions

View file

@ -1822,6 +1822,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 \

View file

@ -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
# -------------------------------

View file

@ -50,6 +50,7 @@ (define-module (gnu packages python-science)
#: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 @@ (define-module (gnu packages python-science)
#: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 @@ (define-module (gnu packages python-science)
#: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 @@ (define-public python-aplus
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")