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