at master 2.1 kB view raw
1{ 2 lib, 3 buildPythonPackage, 4 fetchFromGitHub, 5 replaceVars, 6 applyPatches, 7 8 # build-system 9 cmake, 10 ninja, 11 scikit-build-core, 12 pybind11, 13 setuptools-scm, 14 15 # dependencies 16 jinja2, 17 joblib, 18 numpy, 19 scipy, 20 21 # tests 22 cvxopt, 23 pytestCheckHook, 24 torch, 25}: 26 27let 28 qdldl_src = fetchFromGitHub { 29 owner = "osqp"; 30 repo = "qdldl"; 31 tag = "v0.1.8"; 32 hash = "sha256-qCeOs4UjZLuqlbiLgp6BMxvw4niduCPDOOqFt05zi2E="; 33 }; 34 35 osqp_src = applyPatches { 36 src = fetchFromGitHub { 37 owner = "osqp"; 38 repo = "osqp"; 39 tag = "v1.0.0"; 40 hash = "sha256-BOAytzJzHcggncQzeDrXwJOq8B3doWERJ6CKIVg1yJY="; 41 }; 42 patches = [ 43 (replaceVars ./dont-fetch-qdldl.patch { 44 inherit qdldl_src; 45 }) 46 ]; 47 }; 48in 49 50buildPythonPackage rec { 51 pname = "osqp"; 52 version = "1.0.4"; 53 pyproject = true; 54 55 src = fetchFromGitHub { 56 owner = "osqp"; 57 repo = "osqp-python"; 58 tag = "v${version}"; 59 hash = "sha256-i39tphtGO//MS5sqwn6qx5ORR/A8moi0O8ltGGmkv2w="; 60 }; 61 62 patches = [ 63 (replaceVars ./dont-fetch-osqp.patch { 64 inherit osqp_src; 65 }) 66 ]; 67 68 build-system = [ 69 cmake 70 ninja 71 pybind11 72 scikit-build-core 73 setuptools-scm 74 ]; 75 dontUseCmakeConfigure = true; 76 77 dependencies = [ 78 jinja2 79 joblib 80 numpy 81 scipy 82 ]; 83 84 nativeCheckInputs = [ 85 cvxopt 86 pytestCheckHook 87 torch 88 ]; 89 90 pythonImportsCheck = [ "osqp" ]; 91 92 disabledTestPaths = [ 93 # CalledProcessError 94 # Try to invoke `python setup.py build_ext --inplace` 95 "src/osqp/tests/codegen_matrices_test.py" 96 "src/osqp/tests/codegen_vectors_test.py" 97 ]; 98 99 meta = { 100 description = "Operator Splitting QP Solver"; 101 longDescription = '' 102 Numerical optimization package for solving problems in the form 103 minimize 0.5 x' P x + q' x 104 subject to l <= A x <= u 105 106 where x in R^n is the optimization variable 107 ''; 108 homepage = "https://osqp.org/"; 109 downloadPage = "https://github.com/oxfordcontrol/osqp-python/releases"; 110 license = lib.licenses.asl20; 111 maintainers = with lib.maintainers; [ drewrisinger ]; 112 }; 113}