python312Packages.pot: migrate to optional-dependencies

This commit is contained in:
natsukium 2024-07-07 14:32:58 +09:00
parent 3e5e84c829
commit 98b89f97cb
No known key found for this signature in database
GPG Key ID: 9EA45A31DB994C53

View File

@ -3,9 +3,10 @@
autograd,
buildPythonPackage,
fetchFromGitHub,
cupy,
cvxopt,
cython,
jax,
jaxlib,
matplotlib,
numpy,
pymanopt,
@ -14,8 +15,8 @@
scikit-learn,
scipy,
setuptools,
enableDimensionalityReduction ? false,
enableGPU ? false,
tensorflow,
torch,
}:
buildPythonPackage rec {
@ -38,25 +39,48 @@ buildPythonPackage rec {
numpy
];
dependencies =
[
numpy
scipy
]
++ lib.optionals enableGPU [ cupy ]
++ lib.optionals enableDimensionalityReduction [
autograd
pymanopt
];
nativeCheckInputs = [
cvxopt
matplotlib
dependencies = [
numpy
scikit-learn
pytestCheckHook
scipy
];
optional-dependencies = {
backend-numpy = [ ];
backend-jax = [
jax
jaxlib
];
backend-cupy = [ ];
backend-tf = [ tensorflow ];
backend-torch = [ torch ];
cvxopt = [ cvxopt ];
dr = [
scikit-learn
pymanopt
autograd
];
gnn = [
torch
# torch-geometric
];
plot = [ matplotlib ];
all =
with optional-dependencies;
(
backend-numpy
++ backend-jax
++ backend-cupy
++ backend-tf
++ backend-torch
++ optional-dependencies.cvxopt
++ dr
++ gnn
++ plot
);
};
nativeCheckInputs = [ pytestCheckHook ];
postPatch = ''
substituteInPlace setup.cfg \
--replace " --cov-report= --cov=ot" "" \
@ -108,8 +132,6 @@ buildPythonPackage rec {
"test_emd1d_device_tf"
];
disabledTestPaths = lib.optionals (!enableDimensionalityReduction) [ "test/test_dr.py" ];
pythonImportsCheck = [
"ot"
"ot.lp"