summary refs log tree commit diff
path: root/pkgs/development/python-modules/pymanopt/default.nix
blob: d6fbdacf4650df79a4e71161a502da39cb1c0330 (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
{ lib
, fetchFromGitHub
, buildPythonPackage
, numpy
, scipy
, torch
, autograd
, matplotlib
, pytestCheckHook
}:

buildPythonPackage rec {
  pname = "pymanopt";
  version = "2.2.0";
  format = "setuptools";

  src = fetchFromGitHub {
    owner = pname;
    repo = pname;
    rev = "refs/tags/${version}";
    hash = "sha256-pDFRYhswcuAHG9pcqvzXIy3Ivhxe5R5Ric7AFRh7MK4=";
  };

  propagatedBuildInputs = [ numpy scipy torch ];
  nativeCheckInputs = [ autograd matplotlib pytestCheckHook ];

  preCheck = ''
    substituteInPlace "tests/conftest.py" \
      --replace "import tensorflow as tf" ""
    substituteInPlace "tests/conftest.py" \
      --replace "tf.random.set_seed(seed)" ""
  '';

  disabledTestPaths = [
    "tests/test_examples.py"
    "tests/backends/test_tensorflow.py"
    "tests/test_problem.py"
  ];

  pythonImportsCheck = [ "pymanopt" ];

  meta = {
    description = "Python toolbox for optimization on Riemannian manifolds with support for automatic differentiation";
    homepage = "https://www.pymanopt.org/";
    license = lib.licenses.bsd3;
    maintainers = with lib.maintainers; [ yl3dy ];
    broken = lib.versionAtLeast scipy.version "1.10.0";
  };
}