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