diff --git a/pkgs/development/python-modules/cvxpy/default.nix b/pkgs/development/python-modules/cvxpy/default.nix index 43c49639dc2f..f2b3eef531f5 100644 --- a/pkgs/development/python-modules/cvxpy/default.nix +++ b/pkgs/development/python-modules/cvxpy/default.nix @@ -3,7 +3,6 @@ stdenv, buildPythonPackage, fetchFromGitHub, - fetchpatch, # build-system numpy, @@ -15,8 +14,10 @@ cvxopt, highspy, osqp, + qdldl, scipy, scs, + sparsediffpy, # tests hypothesis, @@ -27,7 +28,7 @@ buildPythonPackage (finalAttrs: { pname = "cvxpy"; - version = "1.8.2"; + version = "1.9.0"; pyproject = true; __structuredAttrs = true; @@ -35,18 +36,9 @@ buildPythonPackage (finalAttrs: { owner = "cvxpy"; repo = "cvxpy"; tag = "v${finalAttrs.version}"; - hash = "sha256-MDKTuiePzqdIJlTRxbCOxoaEAisGx368iWbwKEB97QU="; + hash = "sha256-48tczmRdNExerlVTNMuRNi1dC5XhUSXNBwIGbJ9vFnU="; }; - patches = [ - # Upstream PR: https://github.com/cvxpy/cvxpy/pull/3290 - (fetchpatch { - name = "highs-1.14.0.patch"; - url = "https://github.com/cvxpy/cvxpy/commit/89f8d337d927457c2e308de8295dd83f274e40e7.patch"; - hash = "sha256-BO878Kz5ZH5FHkxZugzT+n6wjsoOReqCZWM2HDvFqAw="; - }) - ]; - postPatch = # too tight tolerance in tests (AssertionError) '' @@ -68,8 +60,10 @@ buildPythonPackage (finalAttrs: { highspy numpy osqp + qdldl scipy scs + sparsediffpy ]; nativeCheckInputs = [ @@ -86,6 +80,11 @@ buildPythonPackage (finalAttrs: { enabledTestPaths = [ "cvxpy" ]; disabledTests = [ + # Numerical assertions failing + "test_oprelcone_1_m1_k3_real" + "test_oprelcone_1_m3_k1_real" + "test_oprelcone_1_m4_k4_real" + # Disable the slowest benchmarking tests, cuts test time in half "test_tv_inpainting" "test_diffcp_sdp_example" diff --git a/pkgs/development/python-modules/sparsediffpy/default.nix b/pkgs/development/python-modules/sparsediffpy/default.nix new file mode 100644 index 000000000000..5b84d329f292 --- /dev/null +++ b/pkgs/development/python-modules/sparsediffpy/default.nix @@ -0,0 +1,59 @@ +{ + lib, + buildPythonPackage, + fetchFromGitHub, + + # build-system + cmake, + ninja, + numpy, + scikit-build-core, + + # buildInputs + blas, +}: + +buildPythonPackage (finalAttrs: { + pname = "sparsediffpy"; + version = "0.3.0"; + pyproject = true; + + src = fetchFromGitHub { + owner = "SparseDifferentiation"; + repo = "SparseDiffPy"; + tag = "v${finalAttrs.version}"; + # SparseDiffEngine is built from source and their cmake does not support finding it on the + # system. We fallback to using the git submodule approach for now. + fetchSubmodules = true; + hash = "sha256-4FiObnGIJSSH7BMkKS7y7rc4HYzDgMV7ym+wPZ/KHJ8="; + }; + + build-system = [ + cmake + ninja + numpy + scikit-build-core + ]; + dontUseCmakeConfigure = true; + + buildInputs = [ + blas + ]; + + dependencies = [ + numpy + ]; + + pythonImportsCheck = [ "sparsediffpy" ]; + + # No tests + doCheck = false; + + meta = { + description = "Python bindings for SparseDiffEngine, a C library for computing sparse Jacobians and Hessians"; + homepage = "https://github.com/SparseDifferentiation/SparseDiffPy"; + changelog = "https://github.com/SparseDifferentiation/SparseDiffPy/blob/${finalAttrs.src.tag}/RELEASES.md"; + license = lib.licenses.asl20; + maintainers = with lib.maintainers; [ GaetanLepage ]; + }; +}) diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 569e979191bc..00be0656f960 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -18323,6 +18323,8 @@ self: super: with self; { sparse = callPackage ../development/python-modules/sparse { }; + sparsediffpy = callPackage ../development/python-modules/sparsediffpy { }; + spatial-image = callPackage ../development/python-modules/spatial-image { }; spatialmath-python = callPackage ../development/python-modules/spatialmath-python { };