1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 fetchpatch,
6 numpy,
7 llvmPackages,
8 wurlitzer,
9 pytestCheckHook,
10}:
11
12buildPythonPackage rec {
13 pname = "wasserstein";
14 version = "1.1.0";
15 format = "setuptools";
16
17 src = fetchFromGitHub {
18 owner = "pkomiske";
19 repo = "Wasserstein";
20 rev = "v${version}";
21 hash = "sha256-s9en6XwvO/WPsF7/+SEmGePHZQgl7zLgu5sEn4nD9YE=";
22 };
23
24 patches = [
25 (fetchpatch {
26 url = "https://github.com/thaler-lab/Wasserstein/commit/8667d59dfdf89eabf01f3ae93b23a30a27c21c58.patch";
27 hash = "sha256-jp5updB3E1MYgLhBJwmBMTwBiFXtABMwTxt0G6xhoyA=";
28 })
29 ];
30
31 buildInputs = [ llvmPackages.openmp ];
32 propagatedBuildInputs = [
33 numpy
34 wurlitzer
35 ];
36
37 nativeCheckInputs = [ pytestCheckHook ];
38 enabledTestPaths = [ "wasserstein/tests" ];
39 disabledTestPaths = [
40 "wasserstein/tests/test_emd.py" # requires "ot"
41 # cyclic dependency on energyflow
42 "wasserstein/tests/test_externalemdhandler.py"
43 "wasserstein/tests/test_pairwiseemd.py"
44 ];
45
46 pythonImportsCheck = [ "wasserstein" ];
47
48 meta = with lib; {
49 description = "Python/C++ library for computing Wasserstein distances efficiently";
50 homepage = "https://github.com/pkomiske/Wasserstein";
51 license = licenses.gpl3Only;
52 maintainers = with maintainers; [ veprbl ];
53 };
54}