at 24.11-pre 1.9 kB view raw
1{ 2 lib, 3 stdenv, 4 buildPythonPackage, 5 clarabel, 6 cvxopt, 7 ecos, 8 fetchPypi, 9 numpy, 10 osqp, 11 pytestCheckHook, 12 pythonOlder, 13 scipy, 14 scs, 15 setuptools, 16 wheel, 17 pybind11, 18 useOpenmp ? (!stdenv.isDarwin), 19}: 20 21buildPythonPackage rec { 22 pname = "cvxpy"; 23 version = "1.4.3"; 24 format = "pyproject"; 25 26 disabled = pythonOlder "3.7"; 27 28 src = fetchPypi { 29 inherit pname version; 30 hash = "sha256-sbB4yMBZI60Sjn2BSwvhwzesBSYqeLdXqOb5V2SK2VM="; 31 }; 32 33 # we need to patch out numpy version caps from upstream 34 postPatch = '' 35 sed -i 's/\(numpy>=[0-9.]*\),<[0-9.]*;/\1;/g' pyproject.toml 36 ''; 37 38 nativeBuildInputs = [ 39 setuptools 40 wheel 41 pybind11 42 ]; 43 44 propagatedBuildInputs = [ 45 clarabel 46 cvxopt 47 ecos 48 numpy 49 osqp 50 scipy 51 scs 52 ]; 53 54 nativeCheckInputs = [ pytestCheckHook ]; 55 56 # Required flags from https://github.com/cvxpy/cvxpy/releases/tag/v1.1.11 57 preBuild = lib.optionalString useOpenmp '' 58 export CFLAGS="-fopenmp" 59 export LDFLAGS="-lgomp" 60 ''; 61 62 pytestFlagsArray = [ "cvxpy" ]; 63 64 disabledTests = 65 [ 66 # Disable the slowest benchmarking tests, cuts test time in half 67 "test_tv_inpainting" 68 "test_diffcp_sdp_example" 69 "test_huber" 70 "test_partial_problem" 71 # https://github.com/cvxpy/cvxpy/issues/2174 72 "test_scipy_mi_time_limit_reached" 73 ] 74 ++ lib.optionals stdenv.isAarch64 [ 75 "test_ecos_bb_mi_lp_2" # https://github.com/cvxpy/cvxpy/issues/1241#issuecomment-780912155 76 ]; 77 78 pythonImportsCheck = [ "cvxpy" ]; 79 80 meta = with lib; { 81 description = "A domain-specific language for modeling convex optimization problems in Python"; 82 homepage = "https://www.cvxpy.org/"; 83 downloadPage = "https://github.com/cvxpy/cvxpy//releases"; 84 changelog = "https://github.com/cvxpy/cvxpy/releases/tag/v${version}"; 85 license = licenses.asl20; 86 maintainers = with maintainers; [ drewrisinger ]; 87 }; 88}