summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/pymanopt/default.nix
blob: 856d7b768efd34b8a4d56cb0ad6653cc5da1dab7 (plain)
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
{
  lib,
  stdenv,
  fetchFromGitHub,
  buildPythonPackage,

  # build-system
  setuptools-scm,

  # dependencies
  numpy,
  scipy,

  # tests
  autograd,
  jax,
  matplotlib,
  pytestCheckHook,
  tensorflow,
  torch,
}:

buildPythonPackage rec {
  pname = "pymanopt";
  version = "2.2.1";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "pymanopt";
    repo = "pymanopt";
    tag = version;
    hash = "sha256-LOEulticgCWZBCf3qj5KFBHt0lMd4H85368IhG3DQ4g=";
  };

  preConfigure = ''
    substituteInPlace pyproject.toml \
      --replace-fail '"pip==22.3.1",' ""
  '';

  build-system = [
    setuptools-scm
  ];

  dependencies = [
    numpy
    scipy
  ];

  pythonImportsCheck = [ "pymanopt" ];

  nativeCheckInputs = [
    autograd
    jax
    matplotlib
    pytestCheckHook
    tensorflow
    torch
  ];

  disabledTestPaths = lib.optionals stdenv.hostPlatform.isDarwin [
    # FloatingPointError: divide by zero encountered in det
    "tests/manifolds/test_positive_definite.py::TestMultiSpecialHermitianPositiveDefiniteManifold::test_retraction"
    "tests/manifolds/test_positive_definite.py::TestSingleSpecialHermitianPositiveDefiniteManifold::test_retraction"
  ];

  meta = {
    description = "Python toolbox for optimization on Riemannian manifolds with support for automatic differentiation";
    homepage = "https://www.pymanopt.org/";
    changelog = "https://github.com/pymanopt/pymanopt/releases/tag/${version}";
    license = lib.licenses.bsd3;
    maintainers = with lib.maintainers; [ yl3dy ];
  };
}