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