depot/third_party/nixpkgs/pkgs/development/python-modules/pot/default.nix
Default email 81047829ea Project import generated by Copybara.
GitOrigin-RevId: 48d63e924a2666baf37f4f14a18f19347fbd54a2
2022-02-10 15:34:41 -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.1.0";
src = fetchPypi {
pname = "POT";
inherit version;
sha256 = "ff2974418fbf35b18072555c2a9e7e4f6876eddfb6791179ddb8f0f6d6032505";
};
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 ];
};
}