2020-01-28 14:59:40 +00:00
|
|
|
{ lib
|
2021-04-12 14:04:03 +01:00
|
|
|
, stdenv
|
2020-01-28 14:59:40 +00:00
|
|
|
, pythonOlder
|
|
|
|
, buildPythonPackage
|
|
|
|
, fetchPypi
|
|
|
|
, cvxopt
|
|
|
|
, ecos
|
|
|
|
, numpy
|
|
|
|
, osqp
|
|
|
|
, scipy
|
|
|
|
, scs
|
2021-05-07 20:49:00 +01:00
|
|
|
, useOpenmp ? (!stdenv.isDarwin)
|
2020-01-28 14:59:40 +00:00
|
|
|
# Check inputs
|
2020-08-27 14:13:27 +01:00
|
|
|
, pytestCheckHook
|
2020-01-28 14:59:40 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "cvxpy";
|
2021-07-03 11:21:03 +01:00
|
|
|
version = "1.1.13";
|
2021-04-12 14:04:03 +01:00
|
|
|
format = "pyproject";
|
2020-01-28 14:59:40 +00:00
|
|
|
|
|
|
|
disabled = pythonOlder "3.5";
|
|
|
|
|
|
|
|
src = fetchPypi {
|
|
|
|
inherit pname version;
|
2021-07-03 11:21:03 +01:00
|
|
|
sha256 = "012avhf0a8n9xyy4g3xcr5z8z2a3m6rnqic6gfs9fq6p9bkq3ix9";
|
2020-01-28 14:59:40 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
propagatedBuildInputs = [
|
|
|
|
cvxopt
|
|
|
|
ecos
|
2020-04-02 16:42:33 +01:00
|
|
|
numpy
|
2020-01-28 14:59:40 +00:00
|
|
|
osqp
|
2020-04-02 16:42:33 +01:00
|
|
|
scipy
|
2020-01-28 14:59:40 +00:00
|
|
|
scs
|
|
|
|
];
|
|
|
|
|
2021-04-12 16:41:37 +01:00
|
|
|
# Required flags from https://github.com/cvxgrp/cvxpy/releases/tag/v1.1.11
|
2021-08-18 01:14:20 +01:00
|
|
|
preBuild = lib.optionalString useOpenmp ''
|
2021-04-12 16:41:37 +01:00
|
|
|
export CFLAGS="-fopenmp"
|
|
|
|
export LDFLAGS="-lgomp"
|
|
|
|
'';
|
|
|
|
|
2021-02-17 23:02:36 +00:00
|
|
|
checkInputs = [ pytestCheckHook ];
|
2021-07-03 11:21:03 +01:00
|
|
|
|
2020-08-27 14:13:27 +01:00
|
|
|
pytestFlagsArray = [ "./cvxpy" ];
|
2021-07-03 11:21:03 +01:00
|
|
|
|
|
|
|
# Disable the slowest benchmarking tests, cuts test time in half
|
2020-08-27 14:13:27 +01:00
|
|
|
disabledTests = [
|
|
|
|
"test_tv_inpainting"
|
|
|
|
"test_diffcp_sdp_example"
|
2021-04-12 14:04:03 +01:00
|
|
|
] ++ lib.optionals stdenv.isAarch64 [
|
|
|
|
"test_ecos_bb_mi_lp_2" # https://github.com/cvxgrp/cvxpy/issues/1241#issuecomment-780912155
|
2020-08-27 14:13:27 +01:00
|
|
|
];
|
2020-01-28 14:59:40 +00:00
|
|
|
|
2021-07-03 11:21:03 +01:00
|
|
|
pythonImportsCheck = [ "cvxpy" ];
|
|
|
|
|
2020-04-02 16:42:33 +01:00
|
|
|
meta = with lib; {
|
2021-02-17 23:02:36 +00:00
|
|
|
description = "A domain-specific language for modeling convex optimization problems in Python";
|
2020-01-28 14:59:40 +00:00
|
|
|
homepage = "https://www.cvxpy.org/";
|
2020-04-09 22:47:27 +01:00
|
|
|
downloadPage = "https://github.com/cvxgrp/cvxpy/releases";
|
2020-08-27 14:13:27 +01:00
|
|
|
changelog = "https://github.com/cvxgrp/cvxpy/releases/tag/v${version}";
|
2020-04-02 16:42:33 +01:00
|
|
|
license = licenses.asl20;
|
|
|
|
maintainers = with maintainers; [ drewrisinger ];
|
2020-01-28 14:59:40 +00:00
|
|
|
};
|
|
|
|
}
|