anki-bin: 24.06.3 -> 24.11 (#360722)
[NixPkgs.git] / pkgs / development / python-modules / cvxpy / default.nix
blob4e49046a1e239e7510e2ee9af13e90686d1bfd3b
2   lib,
3   stdenv,
4   buildPythonPackage,
5   pythonOlder,
6   fetchFromGitHub,
8   # build-system
9   numpy,
10   pybind11,
11   setuptools,
13   # dependencies
14   clarabel,
15   cvxopt,
16   ecos,
17   osqp,
18   scipy,
19   scs,
21   # checks
22   pytestCheckHook,
24   useOpenmp ? (!stdenv.hostPlatform.isDarwin),
27 buildPythonPackage rec {
28   pname = "cvxpy";
29   version = "1.5.3";
30   pyproject = true;
32   disabled = pythonOlder "3.9";
34   src = fetchFromGitHub {
35     owner = "cvxpy";
36     repo = "cvxpy";
37     rev = "refs/tags/v${version}";
38     hash = "sha256-6RaEyFckvF3WhbfeffysMB/zt+aU1NU6B7Nm06znt9k=";
39   };
41   # we need to patch out numpy version caps from upstream
42   postPatch = ''
43     substituteInPlace pyproject.toml \
44       --replace-fail "numpy >= 2.0.0" "numpy"
45   '';
47   build-system = [
48     numpy
49     pybind11
50     setuptools
51   ];
53   dependencies = [
54     clarabel
55     cvxopt
56     ecos
57     numpy
58     osqp
59     scipy
60     scs
61   ];
63   nativeCheckInputs = [ pytestCheckHook ];
65   # Required flags from https://github.com/cvxpy/cvxpy/releases/tag/v1.1.11
66   preBuild = lib.optionalString useOpenmp ''
67     export CFLAGS="-fopenmp"
68     export LDFLAGS="-lgomp"
69   '';
71   pytestFlagsArray = [ "cvxpy" ];
73   disabledTests = [
74     # Disable the slowest benchmarking tests, cuts test time in half
75     "test_tv_inpainting"
76     "test_diffcp_sdp_example"
77     "test_huber"
78     "test_partial_problem"
79   ];
81   pythonImportsCheck = [ "cvxpy" ];
83   meta = {
84     description = "Domain-specific language for modeling convex optimization problems in Python";
85     homepage = "https://www.cvxpy.org/";
86     downloadPage = "https://github.com/cvxpy/cvxpy//releases";
87     changelog = "https://github.com/cvxpy/cvxpy/releases/tag/v${version}";
88     license = lib.licenses.asl20;
89     maintainers = with lib.maintainers; [ drewrisinger ];
90   };