summary refs log tree commit diff
path: root/pkgs/development/python-modules/osqp/default.nix
blob: fc001c52a5ef72b6615bd3bfde1778a7640397d1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
{ lib
, buildPythonPackage
, cmake
, cvxopt
, fetchPypi
, future
, numpy
, pytestCheckHook
, pythonOlder
, qdldl
, scipy
, setuptools-scm
}:

buildPythonPackage rec {
  pname = "osqp";
  version = "0.6.2.post8";
  format = "setuptools";

  disabled = pythonOlder "3.7";

  src = fetchPypi {
    inherit pname version;
    hash = "sha256-I9a65KNhL2DV9lLQ5fpLLq1QfKv/9dkw2CIFeubtZnc=";
  };

  postPatch = ''
    sed -i 's/sp.random/np.random/g' src/osqp/tests/*.py
  '';

  SETUPTOOLS_SCM_PRETEND_VERSION = version;

  dontUseCmakeConfigure = true;

  nativeBuildInputs = [
    cmake
    setuptools-scm
  ];

  propagatedBuildInputs = [
    future
    numpy
    qdldl
    scipy
  ];

  checkInputs = [
    cvxopt
    pytestCheckHook
  ];

  pythonImportsCheck = [
    "osqp"
  ];

  disabledTests = [
    # Test are failing due to scipy update (removal of scipy.random in 1.9.0)
    # Is fixed upstream but requires a new release
    "test_feasibility_problem"
    "test_issue14"
    "test_polish_random"
    "test_polish_unconstrained"
    "test_primal_and_dual_infeasible_problem"
    "test_primal_infeasible_problem"
    "test_solve"
    "test_unconstrained_problem"
    "test_update_A_allind"
    "test_update_A"
    "test_update_bounds"
    "test_update_l"
    "test_update_P_A_allind"
    "test_update_P_A_indA"
    "test_update_P_A_indP_indA"
    "test_update_P_A_indP"
    "test_update_P_allind"
    "test_update_P"
    "test_update_q"
    "test_update_u"
    "test_warm_start"
  ];

  meta = with lib; {
    description = "The Operator Splitting QP Solver";
    longDescription = ''
      Numerical optimization package for solving problems in the form
        minimize        0.5 x' P x + q' x
        subject to      l <= A x <= u

      where x in R^n is the optimization variable
    '';
    homepage = "https://osqp.org/";
    downloadPage = "https://github.com/oxfordcontrol/osqp-python/releases";
    license = licenses.asl20;
    maintainers = with maintainers; [ drewrisinger ];
  };
}