Unverified Commit 7cea7baa authored by Gaétan Lepage's avatar Gaétan Lepage Committed by GitHub
Browse files

python312Packages.pymanopt: cleanup, skip failing tests on darwin (#390895)

parents d9316175 d602c848
Loading
Loading
Loading
Loading
+25 −18
Original line number Diff line number Diff line
{
  lib,
  stdenv,
  fetchFromGitHub,
  buildPythonPackage,

  # build-system
  setuptools-scm,

  # dependencies
  numpy,
  scipy,
  torch,

  # tests
  autograd,
  jax,
  matplotlib,
  pytestCheckHook,
  setuptools-scm,
  tensorflow,
  torch,
}:

buildPythonPackage rec {
@@ -24,42 +33,40 @@ buildPythonPackage rec {
  };

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

  build-system = [
    setuptools-scm
  ];

  dependencies = [
    numpy
    scipy
    torch
  ];

  pythonImportsCheck = [ "pymanopt" ];

  nativeCheckInputs = [
    autograd
    jax
    matplotlib
    pytestCheckHook
    tensorflow
    torch
  ];

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

  disabledTestPaths = [
    "tests/test_examples.py"
    "tests/backends/test_tensorflow.py"
    "tests/backends/test_jax.py"
    "tests/test_problem.py"
  pytestFlagsArray = lib.optionals stdenv.hostPlatform.isDarwin [
    # FloatingPointError: divide by zero encountered in det
    "--deselect=tests/manifolds/test_positive_definite.py::TestMultiSpecialHermitianPositiveDefiniteManifold::test_retraction"
    "--deselect=tests/manifolds/test_positive_definite.py::TestSingleSpecialHermitianPositiveDefiniteManifold::test_retraction"
  ];

  pythonImportsCheck = [ "pymanopt" ];

  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 ];
  };