ansible-later: 2.0.22 -> 2.0.23
[NixPkgs.git] / pkgs / development / python-modules / pot / default.nix
blob2cc9e3368c76a84865b824c1e1242b8f2cfe275a
1 { lib
2 , autograd
3 , buildPythonPackage
4 , cupy
5 , cvxopt
6 , cython
7 , fetchPypi
8 , matplotlib
9 , numpy
10 , tensorflow
11 , pymanopt
12 , pytestCheckHook
13 , pythonOlder
14 , scikit-learn
15 , scipy
16 , enableDimensionalityReduction ? false
17 , enableGPU ? false
20 buildPythonPackage rec {
21   pname = "pot";
22   version = "0.8.2";
23   format = "setuptools";
25   disabled = pythonOlder "3.6";
27   src = fetchPypi {
28     pname = "POT";
29     inherit version;
30     sha256 = "sha256-PKmuPI83DPy7RkOgHHPdPJJz5NT/fpr123AVTzTLwgQ=";
31   };
33   nativeBuildInputs = [
34     numpy
35     cython
36   ];
38   propagatedBuildInputs = [
39     numpy
40     scipy
41   ] ++ lib.optionals enableGPU [
42     cupy
43   ] ++ lib.optionals enableDimensionalityReduction [
44     autograd
45     pymanopt
46   ];
48   checkInputs = [
49     cvxopt
50     matplotlib
51     numpy
52     tensorflow
53     scikit-learn
54     pytestCheckHook
55   ];
57   postPatch = ''
58     substituteInPlace setup.cfg \
59       --replace " --cov-report= --cov=ot" "" \
60       --replace " --durations=20" "" \
61       --replace " --junit-xml=junit-results.xml" ""
62     substituteInPlace setup.py \
63       --replace '"oldest-supported-numpy", ' ""
65     # we don't need setup.py to find the macos sdk for us
66     sed -i '/sdk_path/d' setup.py
67   '';
69   # To prevent importing of an incomplete package from the build directory
70   # instead of nix store (`ot` is the top-level package name).
71   preCheck = ''
72     rm -r ot
73   '';
75   disabledTests = [
76     # GPU tests are always skipped because of sandboxing
77     "warnings"
78     # Fixture is not available
79     "test_conditional_gradient"
80     "test_convert_between_backends"
81     "test_emd_backends"
82     "test_emd_emd2_types_devices"
83     "test_emd1d_type_devices"
84     "test_emd2_backends"
85     "test_factored_ot_backends"
86     "test_free_support_barycenter_backends"
87     "test_func_backends"
88     "test_generalized_conditional_gradient"
89     "test_line_search_armijo"
90     "test_loss_dual"
91     "test_max_sliced_backend"
92     "test_plan_dual"
93     "test_random_backends"
94     "test_sliced_backend"
95     "test_to_numpy"
96     "test_wasserstein_1d_type_devices"
97     "test_wasserstein"
98     "test_weak_ot_bakends"
99     # TypeError: Only integers, slices...
100     "test_emd1d_device_tf"
101   ];
103   disabledTestPaths = [
104     # AttributeError: module pytest has no attribute skip_backend
105     "test/test_bregman.py"
106     "test/test_da.py"
107     "test/test_utils.py"
108     "test/test_gromov.py"
109     "test/test_helpers.py"
110     "test/test_unbalanced.py"
111   ] ++ lib.optionals (!enableDimensionalityReduction) [
112     "test/test_dr.py"
113   ];
115   pythonImportsCheck = [
116     "ot"
117     "ot.lp"
118   ];
120   meta = with lib; {
121     description = "Python Optimal Transport Library";
122     homepage = "https://pythonot.github.io/";
123     license = licenses.mit;
124     maintainers = with maintainers; [ yl3dy ];
125   };