at 23.05-pre 1.6 kB view raw
1{ lib 2, stdenv 3, pythonOlder 4, buildPythonPackage 5, fetchPypi 6, cvxopt 7, ecos 8, numpy 9, osqp 10, scipy 11, scs 12, setuptools 13, useOpenmp ? (!stdenv.isDarwin) 14 # Check inputs 15, pytestCheckHook 16}: 17 18buildPythonPackage rec { 19 pname = "cvxpy"; 20 version = "1.2.1"; 21 format = "pyproject"; 22 23 disabled = pythonOlder "3.5"; 24 25 src = fetchPypi { 26 inherit pname version; 27 sha256 = "sha256-bWdkJkPR3bLyr1m0Zrh9QsSi42eDGte0PDO1nu+ltQ4="; 28 }; 29 30 propagatedBuildInputs = [ 31 cvxopt 32 ecos 33 numpy 34 osqp 35 scipy 36 scs 37 setuptools 38 ]; 39 40 # Required flags from https://github.com/cvxgrp/cvxpy/releases/tag/v1.1.11 41 preBuild = lib.optionalString useOpenmp '' 42 export CFLAGS="-fopenmp" 43 export LDFLAGS="-lgomp" 44 ''; 45 46 checkInputs = [ pytestCheckHook ]; 47 48 pytestFlagsArray = [ "./cvxpy" ]; 49 50 # Disable the slowest benchmarking tests, cuts test time in half 51 disabledTests = [ 52 "test_tv_inpainting" 53 "test_diffcp_sdp_example" 54 "test_huber" 55 "test_partial_problem" 56 ] ++ lib.optionals stdenv.isAarch64 [ 57 "test_ecos_bb_mi_lp_2" # https://github.com/cvxgrp/cvxpy/issues/1241#issuecomment-780912155 58 ]; 59 60 pythonImportsCheck = [ "cvxpy" ]; 61 62 meta = with lib; { 63 description = "A domain-specific language for modeling convex optimization problems in Python"; 64 homepage = "https://www.cvxpy.org/"; 65 downloadPage = "https://github.com/cvxgrp/cvxpy/releases"; 66 changelog = "https://github.com/cvxgrp/cvxpy/releases/tag/v${version}"; 67 license = licenses.asl20; 68 maintainers = with maintainers; [ drewrisinger ]; 69 }; 70}