2024-06-05 15:53:02 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
stdenv,
|
|
|
|
buildPythonPackage,
|
|
|
|
clarabel,
|
|
|
|
cvxopt,
|
|
|
|
ecos,
|
|
|
|
fetchPypi,
|
|
|
|
numpy,
|
|
|
|
osqp,
|
|
|
|
pytestCheckHook,
|
|
|
|
pythonOlder,
|
|
|
|
scipy,
|
|
|
|
scs,
|
|
|
|
setuptools,
|
|
|
|
wheel,
|
|
|
|
pybind11,
|
|
|
|
useOpenmp ? (!stdenv.isDarwin),
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "cvxpy";
|
2024-05-15 15:35:15 +00:00
|
|
|
version = "1.4.3";
|
2021-04-13 19:44:15 +00:00
|
|
|
format = "pyproject";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-05-24 13:37:59 +00:00
|
|
|
disabled = pythonOlder "3.7";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchPypi {
|
|
|
|
inherit pname version;
|
2024-05-15 15:35:15 +00:00
|
|
|
hash = "sha256-sbB4yMBZI60Sjn2BSwvhwzesBSYqeLdXqOb5V2SK2VM=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2023-08-22 20:05:09 +00:00
|
|
|
# we need to patch out numpy version caps from upstream
|
|
|
|
postPatch = ''
|
|
|
|
sed -i 's/\(numpy>=[0-9.]*\),<[0-9.]*;/\1;/g' pyproject.toml
|
|
|
|
'';
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
setuptools
|
|
|
|
wheel
|
2023-11-16 04:20:00 +00:00
|
|
|
pybind11
|
2023-08-22 20:05:09 +00:00
|
|
|
];
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
propagatedBuildInputs = [
|
2024-01-25 14:12:00 +00:00
|
|
|
clarabel
|
2020-04-24 23:36:52 +00:00
|
|
|
cvxopt
|
|
|
|
ecos
|
|
|
|
numpy
|
|
|
|
osqp
|
|
|
|
scipy
|
|
|
|
scs
|
|
|
|
];
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
nativeCheckInputs = [ pytestCheckHook ];
|
2023-05-24 13:37:59 +00:00
|
|
|
|
|
|
|
# Required flags from https://github.com/cvxpy/cvxpy/releases/tag/v1.1.11
|
2021-08-22 07:53:02 +00:00
|
|
|
preBuild = lib.optionalString useOpenmp ''
|
2021-04-13 19:44:15 +00:00
|
|
|
export CFLAGS="-fopenmp"
|
|
|
|
export LDFLAGS="-lgomp"
|
|
|
|
'';
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
pytestFlagsArray = [ "cvxpy" ];
|
2021-07-04 02:40:35 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
disabledTests =
|
|
|
|
[
|
|
|
|
# Disable the slowest benchmarking tests, cuts test time in half
|
|
|
|
"test_tv_inpainting"
|
|
|
|
"test_diffcp_sdp_example"
|
|
|
|
"test_huber"
|
|
|
|
"test_partial_problem"
|
|
|
|
# https://github.com/cvxpy/cvxpy/issues/2174
|
|
|
|
"test_scipy_mi_time_limit_reached"
|
|
|
|
]
|
|
|
|
++ lib.optionals stdenv.isAarch64 [
|
|
|
|
"test_ecos_bb_mi_lp_2" # https://github.com/cvxpy/cvxpy/issues/1241#issuecomment-780912155
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
pythonImportsCheck = [ "cvxpy" ];
|
2021-07-04 02:40:35 +00:00
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
meta = with lib; {
|
2024-06-20 14:57:18 +00:00
|
|
|
description = "Domain-specific language for modeling convex optimization problems in Python";
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://www.cvxpy.org/";
|
2023-05-24 13:37:59 +00:00
|
|
|
downloadPage = "https://github.com/cvxpy/cvxpy//releases";
|
|
|
|
changelog = "https://github.com/cvxpy/cvxpy/releases/tag/v${version}";
|
2020-04-24 23:36:52 +00:00
|
|
|
license = licenses.asl20;
|
|
|
|
maintainers = with maintainers; [ drewrisinger ];
|
|
|
|
};
|
|
|
|
}
|