Subject: [bug#76150] [PATCH 06/16] gnu: Add python-cylp.

From: Vinicius Monego <[email-masked]>
Date: Sun, 9 Feb 2025 01:52:23 +0000

* gnu/packages/maths.scm (python-cylp): New variable.

Change-Id: Id3467bc34833472aa7fca3416801a5fbf5c033e6
---
 gnu/packages/maths.scm | 48 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)

diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm
index 2c89451d0f..44bd1b15d9 100644
--- a/gnu/packages/maths.scm
+++ b/gnu/packages/maths.scm
@@ -2739,6 +2739,54 @@ (define-public clp
 and quadratic objectives using the Simplex algorithm.")
     (license license:epl1.0)))
 
+(define-public python-cylp
+  (package
+    (name "python-cylp")
+    (version "0.92.3")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "cylp" version))
+       (sha256
+        (base32 "1mhvjrhvpgnpw4zwri92dj168qvyclcpsqvzbj5maxx5cilnhkww"))))
+    (build-system pyproject-build-system)
+    (arguments
+     (list
+      #:test-flags #~(list "-k" (string-append
+                                 "not " (string-join
+                                         (list
+                                          "test_removeVar2" ; AssertionError
+                                          ;; Tests below segfault
+                                          "test_dantzig"
+                                          "test_lifo"
+                                          "test_mf"
+                                          "test_pe")
+                                         " and not ")))
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-before 'check 'pre-check
+            (lambda* (#:key tests? #:allow-other-keys)
+              (if tests? ; rebuild extensions
+                  (invoke "python" "setup.py" "build_ext" "--inplace")))))))
+    (propagated-inputs (list python-numpy python-pytest python-scipy))
+    (inputs (list cbc))
+    (native-inputs (list pkg-config
+                         python-cython-3
+                         python-hypothesis
+                         python-numpy
+                         python-pytest
+                         python-setuptools
+                         python-wheel))
+    (home-page "https://github.com/coin-or/cylp")
+    (synopsis "Python interface for CLP, CBC, and CGL")
+    (description
+     "CyLP is a Python interface to COIN-OR’s Linear and mixed-integer program
+solvers (CLP, CBC, and CGL).  CyLP’s unique feature is that you can use it to
+alter the solution process of the solvers from within Python.  For example,
+you may define cut generators, branch-and-bound strategies, and primal/dual
+Simplex pivot rules completely in Python.")
+    (license license:epl2.0)))
+
 (define-public gecode
   (let* ((commit "f7f0d7c273d6844698f01cec8229ebe0b66a016a")
          (version (git-version "6.2.0" "1" commit)))
-- 
2.48.1