1{
2 lib,
3 buildPythonPackage,
4 cmake,
5 cvxopt,
6 fetchPypi,
7 future,
8 numpy,
9 oldest-supported-numpy,
10 pytestCheckHook,
11 pythonOlder,
12 qdldl,
13 scipy,
14 setuptools-scm,
15}:
16
17buildPythonPackage rec {
18 pname = "osqp";
19 version = "0.6.7.post3";
20 pyproject = true;
21
22 disabled = pythonOlder "3.7";
23
24 src = fetchPypi {
25 inherit pname version;
26 hash = "sha256-sMXgpyHyHJckCXpP1QEIME0pZGjRJOFvNKxnBG9wIOE=";
27 };
28
29 postPatch = ''
30 substituteInPlace pyproject.toml \
31 --replace-fail "numpy >= 2.0.0" numpy
32 '';
33
34 dontUseCmakeConfigure = true;
35
36 nativeBuildInputs = [
37 cmake
38 numpy
39 oldest-supported-numpy
40 setuptools-scm
41 ];
42
43 pythonRelaxDeps = [
44 "scipy"
45 ];
46
47 propagatedBuildInputs = [
48 numpy
49 qdldl
50 scipy
51 ];
52
53 nativeCheckInputs = [
54 cvxopt
55 pytestCheckHook
56 ];
57
58 pythonImportsCheck = [ "osqp" ];
59
60 disabledTests =
61 [
62 # Need an unfree license package - mkl
63 "test_issue14"
64 ]
65 # disable tests failing after scipy 1.12 update
66 # https://github.com/osqp/osqp-python/issues/121
67 # re-enable once unit tests fixed
68 ++ [
69 "feasibility_tests"
70 "polish_tests"
71 "update_matrices_tests"
72 ];
73
74 meta = with lib; {
75 description = "Operator Splitting QP Solver";
76 longDescription = ''
77 Numerical optimization package for solving problems in the form
78 minimize 0.5 x' P x + q' x
79 subject to l <= A x <= u
80
81 where x in R^n is the optimization variable
82 '';
83 homepage = "https://osqp.org/";
84 downloadPage = "https://github.com/oxfordcontrol/osqp-python/releases";
85 license = licenses.asl20;
86 maintainers = with maintainers; [ drewrisinger ];
87 };
88}