1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchFromGitHub,
6
7 # build-system
8 meson-python,
9 numpy,
10 pkg-config,
11
12 # buildInputs
13 Accelerate,
14 blas,
15 lapack,
16
17 # dependencies
18 scipy,
19
20 # check inputs
21 pytestCheckHook,
22}:
23
24buildPythonPackage rec {
25 pname = "scs";
26 version = "3.2.6";
27 pyproject = true;
28
29 src = fetchFromGitHub {
30 owner = "bodono";
31 repo = "scs-python";
32 rev = "refs/tags/${version}";
33 hash = "sha256-Sl0+1/uEXAg+V2ijDFGmez6hBKQjbi63gN26lPCiEnI=";
34 fetchSubmodules = true;
35 };
36
37 postPatch = ''
38 substituteInPlace pyproject.toml \
39 --replace-fail "numpy >= 2.0.0" "numpy"
40 '';
41
42 build-system = [
43 meson-python
44 numpy
45 pkg-config
46 ];
47
48 buildInputs =
49 if stdenv.isDarwin then
50 [ Accelerate ]
51 else
52 [
53 blas
54 lapack
55 ];
56
57 dependencies = [
58 numpy
59 scipy
60 ];
61
62 nativeCheckInputs = [ pytestCheckHook ];
63 pythonImportsCheck = [ "scs" ];
64
65 meta = {
66 description = "Python interface for SCS: Splitting Conic Solver";
67 longDescription = ''
68 Solves convex cone programs via operator splitting.
69 Can solve: linear programs (LPs), second-order cone programs (SOCPs), semidefinite programs (SDPs),
70 exponential cone programs (ECPs), and power cone programs (PCPs), or problems with any combination of those cones.
71 '';
72 homepage = "https://github.com/cvxgrp/scs"; # upstream C package
73 downloadPage = "https://github.com/bodono/scs-python";
74 license = lib.licenses.mit;
75 maintainers = with lib.maintainers; [ drewrisinger ];
76 };
77}