python3Packages.pot: cleanup, fix (#507101)

This commit is contained in:
kirillrdy
2026-04-06 08:47:03 +00:00
committed by GitHub
2 changed files with 59 additions and 40 deletions
@@ -24,7 +24,7 @@
tf-keras,
}:
buildPythonPackage rec {
buildPythonPackage (finalAttrs: {
pname = "energyflow";
version = "1.4.0";
pyproject = true;
@@ -32,7 +32,7 @@ buildPythonPackage rec {
src = fetchFromGitHub {
owner = "pkomiske";
repo = "EnergyFlow";
tag = "v${version}";
tag = "v${finalAttrs.version}";
hash = "sha256-4RzhpeOOty8IaVGByHD+PyeaeWgR7ZF98mSCJYoM9wY=";
};
@@ -65,7 +65,7 @@ buildPythonPackage rec {
pytestCheckHook
tf-keras
]
++ lib.concatAttrValues optional-dependencies;
++ lib.concatAttrValues finalAttrs.passthru.optional-dependencies;
disabledTests = [
# Issues with array
@@ -73,6 +73,11 @@ buildPythonPackage rec {
"test_gdim"
"test_n_jobs"
"test_periodic_phi"
# NameError: name '_distance_wrap' is not defined
"test_emd_byhand_1_1"
"test_emd_return_flow"
"test_emde"
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
# RuntimeError: EMDStatus - Infeasible
@@ -86,8 +91,8 @@ buildPythonPackage rec {
meta = {
description = "Python package for the EnergyFlow suite of tools";
homepage = "https://energyflow.network/";
changelog = "https://github.com/thaler-lab/EnergyFlow/releases/tag/v${version}";
changelog = "https://github.com/thaler-lab/EnergyFlow/releases/tag/${finalAttrs.src.tag}";
license = lib.licenses.gpl3Only;
maintainers = with lib.maintainers; [ veprbl ];
};
}
})
+49 -35
View File
@@ -1,25 +1,39 @@
{
lib,
autograd,
buildPythonPackage,
fetchFromGitHub,
cvxopt,
# build-system
cython,
numpy,
setuptools,
# dependencies
scipy,
# optional-dependencies
# backend-jax
jax,
jaxlib,
matplotlib,
numpy,
# backend-tf
tensorflow,
# backend-torch
torch,
# cvxopt
cvxopt,
# dr
scikit-learn,
pymanopt,
autograd,
# plot
matplotlib,
# tests
pytestCheckHook,
pytest-cov-stub,
scikit-learn,
scipy,
setuptools,
tensorflow,
torch,
}:
buildPythonPackage rec {
buildPythonPackage (finalAttrs: {
pname = "pot";
version = "0.9.6.post1";
pyproject = true;
@@ -27,14 +41,23 @@ buildPythonPackage rec {
src = fetchFromGitHub {
owner = "PythonOT";
repo = "POT";
tag = version;
tag = finalAttrs.version;
hash = "sha256-db4fKXqvg9DEmbI/RTQWcOdw+3ccPk74ME0VDsXZlsQ=";
};
postPatch = ''
substituteInPlace setup.cfg \
--replace-fail " --durations=20" "" \
--replace-fail " --junit-xml=junit-results.xml" ""
# we don't need setup.py to find the macos sdk for us
sed -i '/sdk_path/d' setup.py
'';
build-system = [
setuptools
cython
numpy
setuptools
];
dependencies = [
@@ -62,19 +85,6 @@ buildPythonPackage rec {
# 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 = [
@@ -82,15 +92,6 @@ buildPythonPackage rec {
pytest-cov-stub
];
postPatch = ''
substituteInPlace setup.cfg \
--replace " --durations=20" "" \
--replace " --junit-xml=junit-results.xml" ""
# we don't need setup.py to find the macos sdk for us
sed -i '/sdk_path/d' setup.py
'';
# need to run the tests with the built package next to the test directory
preCheck = ''
pushd build/lib.*
@@ -99,6 +100,7 @@ buildPythonPackage rec {
postCheck = ''
popd
rm -rf ot
'';
disabledTests = [
@@ -125,8 +127,18 @@ buildPythonPackage rec {
"test_wasserstein_1d_type_devices"
"test_wasserstein"
"test_weak_ot_bakends"
# TypeError: Only integers, slices...
"test_emd1d_device_tf"
# ValueError: setting an array element with a sequence
"test_fully_relaxed_path"
"test_pointwise_gromov"
"test_semi_relaxed_path"
# ValueError: Unknown Distance Metric: sokalmichener
"test_dist"
"test_dist_vs_cdist"
];
pythonImportsCheck = [
@@ -137,7 +149,9 @@ buildPythonPackage rec {
meta = {
description = "Python Optimal Transport Library";
homepage = "https://pythonot.github.io/";
downloadPage = "https://github.com/PythonOT/POT";
changelog = "https://github.com/PythonOT/POT/blob/${finalAttrs.src.tag}/RELEASES.md";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ yl3dy ];
};
}
})