about summary refs log tree commit diff
path: root/pkgs/development/python-modules/wasserstein/default.nix
blob: c9a9495b42ef322e618629c3cff1befe3fe8a696 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  fetchpatch,
  numpy,
  llvmPackages,
  wurlitzer,
  pytestCheckHook,
}:

buildPythonPackage rec {
  pname = "wasserstein";
  version = "1.1.0";
  format = "setuptools";

  src = fetchFromGitHub {
    owner = "pkomiske";
    repo = "Wasserstein";
    rev = "v${version}";
    hash = "sha256-s9en6XwvO/WPsF7/+SEmGePHZQgl7zLgu5sEn4nD9YE=";
  };

  patches = [
    (fetchpatch {
      url = "https://github.com/thaler-lab/Wasserstein/commit/8667d59dfdf89eabf01f3ae93b23a30a27c21c58.patch";
      hash = "sha256-jp5updB3E1MYgLhBJwmBMTwBiFXtABMwTxt0G6xhoyA=";
    })
  ];

  buildInputs = [ llvmPackages.openmp ];
  propagatedBuildInputs = [
    numpy
    wurlitzer
  ];

  nativeCheckInputs = [ pytestCheckHook ];
  pytestFlagsArray = [ "wasserstein/tests" ];
  disabledTestPaths = [
    "wasserstein/tests/test_emd.py" # requires "ot"
    # cyclic dependency on energyflow
    "wasserstein/tests/test_externalemdhandler.py"
    "wasserstein/tests/test_pairwiseemd.py"
  ];

  pythonImportsCheck = [ "wasserstein" ];

  meta = with lib; {
    description = "Python/C++ library for computing Wasserstein distances efficiently";
    homepage = "https://github.com/pkomiske/Wasserstein";
    license = licenses.gpl3Only;
    maintainers = with maintainers; [ veprbl ];
  };
}