1{
2 lib,
3 fetchFromGitHub,
4 buildPythonPackage,
5 numpy,
6 scipy,
7 torch,
8 autograd,
9 matplotlib,
10 pytestCheckHook,
11 setuptools-scm,
12}:
13
14buildPythonPackage rec {
15 pname = "pymanopt";
16 version = "2.2.1";
17 pyproject = true;
18
19 src = fetchFromGitHub {
20 owner = pname;
21 repo = pname;
22 tag = version;
23 hash = "sha256-LOEulticgCWZBCf3qj5KFBHt0lMd4H85368IhG3DQ4g=";
24 };
25
26 preConfigure = ''
27 substituteInPlace pyproject.toml --replace-fail "\"pip==22.3.1\"," ""
28 '';
29
30 build-system = [
31 setuptools-scm
32 ];
33 dependencies = [
34 numpy
35 scipy
36 torch
37 ];
38 nativeCheckInputs = [
39 autograd
40 matplotlib
41 pytestCheckHook
42 ];
43
44 preCheck = ''
45 substituteInPlace "tests/conftest.py" \
46 --replace-fail "import tensorflow as tf" ""
47 substituteInPlace "tests/conftest.py" \
48 --replace-fail "tf.random.set_seed(seed)" ""
49 '';
50
51 disabledTestPaths = [
52 "tests/test_examples.py"
53 "tests/backends/test_tensorflow.py"
54 "tests/backends/test_jax.py"
55 "tests/test_problem.py"
56 ];
57
58 pythonImportsCheck = [ "pymanopt" ];
59
60 meta = {
61 description = "Python toolbox for optimization on Riemannian manifolds with support for automatic differentiation";
62 homepage = "https://www.pymanopt.org/";
63 license = lib.licenses.bsd3;
64 maintainers = with lib.maintainers; [ yl3dy ];
65 };
66}