Merge pull request #325493 from GaetanLepage/cvxpy

python311Packages.cvxpy: 1.4.3 -> 1.5.2
This commit is contained in:
Sandro 2024-07-17 09:53:04 +02:00 committed by GitHub
commit e69ae7bc1c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 62 additions and 53 deletions

View File

@ -2,46 +2,66 @@
lib,
stdenv,
buildPythonPackage,
pythonOlder,
fetchFromGitHub,
fetchpatch,
# build-system
numpy,
pybind11,
setuptools,
# dependencies
clarabel,
cvxopt,
ecos,
fetchPypi,
numpy,
osqp,
pytestCheckHook,
pythonOlder,
scipy,
scs,
setuptools,
wheel,
pybind11,
# checks
pytestCheckHook,
useOpenmp ? (!stdenv.isDarwin),
}:
buildPythonPackage rec {
pname = "cvxpy";
version = "1.4.3";
format = "pyproject";
version = "1.5.2";
pyproject = true;
disabled = pythonOlder "3.7";
disabled = pythonOlder "3.8";
src = fetchPypi {
inherit pname version;
hash = "sha256-sbB4yMBZI60Sjn2BSwvhwzesBSYqeLdXqOb5V2SK2VM=";
src = fetchFromGitHub {
owner = "cvxpy";
repo = "cvxpy";
rev = "refs/tags/v${version}";
hash = "sha256-g4JVgykGNFT4ZEi5f8hkVjd7eUVJ+LxvPvmiVa86r1Y=";
};
patches = [
# Fix invalid uses of the scipy library
# https://github.com/cvxpy/cvxpy/pull/2508
(fetchpatch {
name = "scipy-1-14-compat";
url = "https://github.com/cvxpy/cvxpy/pull/2508/commits/c343f4381c69f7e6b51a86b3eee8b42fbdda9d6a.patch";
hash = "sha256-SqIdPs9K+GuCLCEJMHUQ+QGWNH5B3tKuwr46tD9Ao2k=";
})
];
# we need to patch out numpy version caps from upstream
postPatch = ''
sed -i 's/\(numpy>=[0-9.]*\),<[0-9.]*;/\1;/g' pyproject.toml
substituteInPlace pyproject.toml \
--replace-fail "numpy >= 2.0.0" "numpy"
'';
nativeBuildInputs = [
setuptools
wheel
build-system = [
numpy
pybind11
setuptools
];
propagatedBuildInputs = [
dependencies = [
clarabel
cvxopt
ecos
@ -77,12 +97,12 @@ buildPythonPackage rec {
pythonImportsCheck = [ "cvxpy" ];
meta = with lib; {
meta = {
description = "Domain-specific language for modeling convex optimization problems in Python";
homepage = "https://www.cvxpy.org/";
downloadPage = "https://github.com/cvxpy/cvxpy//releases";
changelog = "https://github.com/cvxpy/cvxpy/releases/tag/v${version}";
license = licenses.asl20;
maintainers = with maintainers; [ drewrisinger ];
license = lib.licenses.asl20;
maintainers = with lib.maintainers; [ drewrisinger ];
};
}

View File

@ -3,56 +3,45 @@
stdenv,
buildPythonPackage,
fetchFromGitHub,
fetchpatch,
# build-system
meson-python,
numpy,
pkg-config,
# buildInputs
Accelerate,
blas,
lapack,
numpy,
# dependencies
scipy,
# check inputs
pytestCheckHook,
}:
buildPythonPackage rec {
pname = "scs";
version = "3.2.4";
version = "3.2.6";
pyproject = true;
src = fetchFromGitHub {
owner = "bodono";
repo = "scs-python";
rev = version;
hash = "sha256-UmMbnj7QZSvHWSUk1Qa0VP4i3iDCYHxoa+qBmEdFjRs=";
rev = "refs/tags/${version}";
hash = "sha256-Sl0+1/uEXAg+V2ijDFGmez6hBKQjbi63gN26lPCiEnI=";
fetchSubmodules = true;
};
patches = [
# needed for building against netlib's reference blas implementation and
# the pkg-config patch. remove on next update
(fetchpatch {
name = "find-and-ld-lapack.patch";
url = "https://github.com/bodono/scs-python/commit/a0aea80e7d490770d6a47d2c79396f6c3341c1f9.patch";
hash = "sha256-yHF8f7SLoG7veZ6DEq1HVH6rT2KtFONwJtqSiKcxOdg=";
})
# add support for pkg-config. remove on next update
(fetchpatch {
name = "use-pkg-config.patch";
url = "https://github.com/bodono/scs-python/commit/dd17e2e5282ebe85f2df8a7c6b25cfdeb894970d.patch";
hash = "sha256-vSeSJeeu5Wx3RXPyB39YTo0RU8HtAojrUw85Q76/QzA=";
})
# fix test_solve_random_cone_prob on linux after scipy 1.12 update
# https://github.com/bodono/scs-python/pull/82
(fetchpatch {
name = "scipy-1.12-fix.patch";
url = "https://github.com/bodono/scs-python/commit/4baf4effdc2ce7ac2dd1beaf864f1a5292eb06c6.patch";
hash = "sha256-U/F5MakwYZN5hCaeAkcCG38WQxX9mXy9OvhyEQqN038=";
})
];
postPatch = ''
substituteInPlace pyproject.toml \
--replace-fail "numpy >= 2.0.0" "numpy"
'';
nativeBuildInputs = [
build-system = [
meson-python
numpy
pkg-config
];
@ -65,7 +54,7 @@ buildPythonPackage rec {
lapack
];
propagatedBuildInputs = [
dependencies = [
numpy
scipy
];
@ -73,7 +62,7 @@ buildPythonPackage rec {
nativeCheckInputs = [ pytestCheckHook ];
pythonImportsCheck = [ "scs" ];
meta = with lib; {
meta = {
description = "Python interface for SCS: Splitting Conic Solver";
longDescription = ''
Solves convex cone programs via operator splitting.
@ -82,7 +71,7 @@ buildPythonPackage rec {
'';
homepage = "https://github.com/cvxgrp/scs"; # upstream C package
downloadPage = "https://github.com/bodono/scs-python";
license = licenses.mit;
maintainers = with maintainers; [ drewrisinger ];
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ drewrisinger ];
};
}