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-04-12 16:41:37 +01:00
|
|
|
, useOpenmp ? true
|
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-04-12 14:04:03 +01:00
|
|
|
version = "1.1.12";
|
|
|
|
format = "pyproject";
|
2020-01-28 14:59:40 +00:00
|
|
|
|
|
|
|
disabled = pythonOlder "3.5";
|
|
|
|
|
|
|
|
src = fetchPypi {
|
|
|
|
inherit pname version;
|
2021-04-12 14:04:03 +01:00
|
|
|
hash = "sha256-tJnr+uT8ZF6VI2IVc//LHFtoVKG1wM4dZqippFhgWAc=";
|
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
|
|
|
|
preBuild = lib.optional useOpenmp ''
|
|
|
|
export CFLAGS="-fopenmp"
|
|
|
|
export LDFLAGS="-lgomp"
|
|
|
|
'';
|
|
|
|
|
2021-02-17 23:02:36 +00:00
|
|
|
checkInputs = [ pytestCheckHook ];
|
2020-08-27 14:13:27 +01:00
|
|
|
pytestFlagsArray = [ "./cvxpy" ];
|
|
|
|
# Disable the slowest benchmarking tests, cuts test time in half
|
|
|
|
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
|
|
|
|
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
|
|
|
};
|
|
|
|
}
|