1{ lib
2, buildPythonPackage
3, cmake
4, cvxopt
5, fetchPypi
6, future
7, numpy
8, pytestCheckHook
9, pythonOlder
10, qdldl
11, scipy
12, setuptools-scm
13}:
14
15buildPythonPackage rec {
16 pname = "osqp";
17 version = "0.6.2.post5";
18 format = "setuptools";
19
20 disabled = pythonOlder "3.7";
21
22 src = fetchPypi {
23 inherit pname version;
24 hash = "sha256-svoXquQqftSY7CYbM/Jiu0s2BefoRkBiFZ2froF/DWE=";
25 };
26
27 postPatch = ''
28 sed -i 's/sp.random/np.random/g' src/osqp/tests/*.py
29 '';
30
31 SETUPTOOLS_SCM_PRETEND_VERSION = version;
32
33 dontUseCmakeConfigure = true;
34
35 nativeBuildInputs = [
36 cmake
37 setuptools-scm
38 ];
39
40 propagatedBuildInputs = [
41 future
42 numpy
43 qdldl
44 scipy
45 ];
46
47 checkInputs = [
48 cvxopt
49 pytestCheckHook
50 ];
51
52 pythonImportsCheck = [
53 "osqp"
54 ];
55
56 disabledTests = [
57 # Test are failing due to scipy update (removal of scipy.random in 1.9.0)
58 # Is fixed upstream but requires a new release
59 "test_feasibility_problem"
60 "test_issue14"
61 "test_polish_random"
62 "test_polish_unconstrained"
63 "test_primal_and_dual_infeasible_problem"
64 "test_primal_infeasible_problem"
65 "test_solve"
66 "test_unconstrained_problem"
67 "test_update_A_allind"
68 "test_update_A"
69 "test_update_bounds"
70 "test_update_l"
71 "test_update_P_A_allind"
72 "test_update_P_A_indA"
73 "test_update_P_A_indP_indA"
74 "test_update_P_A_indP"
75 "test_update_P_allind"
76 "test_update_P"
77 "test_update_q"
78 "test_update_u"
79 "test_warm_start"
80 ];
81
82 meta = with lib; {
83 description = "The Operator Splitting QP Solver";
84 longDescription = ''
85 Numerical optimization package for solving problems in the form
86 minimize 0.5 x' P x + q' x
87 subject to l <= A x <= u
88
89 where x in R^n is the optimization variable
90 '';
91 homepage = "https://osqp.org/";
92 downloadPage = "https://github.com/oxfordcontrol/osqp-python/releases";
93 license = licenses.asl20;
94 maintainers = with maintainers; [ drewrisinger ];
95 };
96}