depot/third_party/nixpkgs/pkgs/development/python-modules/pot/default.nix
Default email 14910f5943 Project import generated by Copybara.
GitOrigin-RevId: 5aaed40d22f0d9376330b6fa413223435ad6fee5
2022-01-13 15:06:32 -05:00

55 lines
1.3 KiB
Nix

{ lib
, fetchPypi
, buildPythonPackage
, numpy
, scipy
, cython
, matplotlib
, scikit-learn
, cupy
, pymanopt
, autograd
, pytestCheckHook
, enableDimensionalityReduction ? false
, enableGPU ? false
}:
buildPythonPackage rec {
pname = "pot";
version = "0.8.0";
src = fetchPypi {
pname = "POT";
inherit version;
sha256 = "a70e092ddc5a29a4b526192750604a634dfc2faa1641664b4c2c1c00b3cd63cf";
};
postPatch = ''
substituteInPlace setup.cfg \
--replace "--cov-report= --cov=ot" ""
'';
nativeBuildInputs = [ numpy cython ];
propagatedBuildInputs = [ numpy scipy ]
++ lib.optionals enableGPU [ cupy ]
++ lib.optionals enableDimensionalityReduction [ pymanopt autograd ];
checkInputs = [ matplotlib scikit-learn pytestCheckHook ];
# To prevent importing of an incomplete package from the build directory
# instead of nix store (`ot` is the top-level package name).
preCheck = ''
rm -r ot
'';
# GPU tests are always skipped because of sandboxing
disabledTests = [ "warnings" ];
pythonImportsCheck = [ "ot" "ot.lp" ];
meta = {
description = "Python Optimal Transport Library";
homepage = "https://pythonot.github.io/";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ yl3dy ];
};
}