aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarco Baggio <marco.baggio@mdc-berlin.de>2024-04-29 14:59:12 +0200
committerRicardo Wurmus <rekado@elephly.net>2024-05-05 22:38:15 +0200
commita0971243bce66ee738be8cbca3c8e023b6ff68e0 (patch)
tree38a293cd92967c341ca8aff7a6135c26bdc58e0b
parentd051ef0913c74d4b498ed67c165afdc0c2b2d4d5 (diff)
downloadguix-a0971243bce66ee738be8cbca3c8e023b6ff68e0.tar
guix-a0971243bce66ee738be8cbca3c8e023b6ff68e0.tar.gz
gnu: Add python-osqp.
* gnu/packages/python-science.scm (python-osqp): New variable. Co-authored-by: Ricardo Wurmus <rekado@elephly.net> Change-Id: Id6f1665505469fd6543046636b82d0730b319df3
-rw-r--r--gnu/packages/python-science.scm52
1 files changed, 52 insertions, 0 deletions
diff --git a/gnu/packages/python-science.scm b/gnu/packages/python-science.scm
index 37ffcf188e..5a9666fb47 100644
--- a/gnu/packages/python-science.scm
+++ b/gnu/packages/python-science.scm
@@ -89,6 +89,58 @@
#:use-module (guix build-system python)
#:use-module (guix build-system pyproject))
+(define-public python-osqp
+ (package
+ (name "python-osqp")
+ (version "0.6.5")
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/osqp/osqp-python")
+ (commit (string-append "v" version))
+ (recursive? #true)))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32 "0s1nbzkfsi2h4ji3v0k14pfcrvinakrwy4xdbz320lbaq3yb0b65"))))
+ (build-system pyproject-build-system)
+ (arguments
+ (list
+ #:test-flags
+ ;; Some of these test failures are explained by
+ ;; https://github.com/osqp/osqp-python/issues/121.
+ ;; These tests require the module "vec_emosqp", which we don't have.
+ '(list "--ignore=src/osqp/tests/codegen_vectors_test.py"
+ ;; These tests need "mat_emosqp".
+ "--ignore=src/osqp/tests/codegen_matrices_test.py"
+ ;; These fail with accuracy differences
+ "--ignore=src/osqp/tests/update_matrices_test.py"
+ "--ignore=src/osqp/tests/feasibility_test.py"
+ "--ignore=src/osqp/tests/polishing_test.py"
+ ;; This requires the nonfree MKL.
+ "--ignore=src/osqp/tests/mkl_pardiso_test.py")
+ #:phases
+ #~(modify-phases %standard-phases
+ ;; It looks like the upgrade to scipy 1.12.0 only broke the test
+ ;; suite, not the features of this library. See
+ ;; https://github.com/osqp/osqp-python/issues/121.
+ (add-after 'unpack 'relax-requirements
+ (lambda _
+ (substitute* "requirements.txt"
+ (("scipy.*1.12.0") "scipy <= 1.12.0"))))
+ (add-before 'build 'set-version
+ (lambda _
+ (setenv "SETUPTOOLS_SCM_PRETEND_VERSION" #$version))))))
+ (propagated-inputs (list python-numpy python-qdldl python-scipy))
+ ;; We need setuptools-scm only for the version number. Without it the
+ ;; version number will be "0.0.0" and downstream packages will complain.
+ (native-inputs (list cmake-minimal python-pytest python-setuptools-scm))
+ (home-page "https://osqp.org/")
+ (synopsis "OSQP: operator splitting QP solver")
+ (description "The OSQP (Operator Splitting Quadratic Program) solver is a
+numerical optimization package.")
+ (license license:asl2.0)))
+
(define-public python-qdldl
(package
(name "python-qdldl")