From d602c8487a19b8f0c70971ab4d07fa3776ff5bf9 Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Tue, 18 Mar 2025 10:06:44 +0100 Subject: [PATCH] python312Packages.pymanopt: cleanup, skip failing tests on darwin --- .../python-modules/pymanopt/default.nix | 53 +++++++++++-------- 1 file changed, 30 insertions(+), 23 deletions(-) diff --git a/pkgs/development/python-modules/pymanopt/default.nix b/pkgs/development/python-modules/pymanopt/default.nix index 20cac6031746..de1408d95b39 100644 --- a/pkgs/development/python-modules/pymanopt/default.nix +++ b/pkgs/development/python-modules/pymanopt/default.nix @@ -1,14 +1,23 @@ { 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 - ]; - nativeCheckInputs = [ - autograd - matplotlib - pytestCheckHook - ]; - - 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" ]; pythonImportsCheck = [ "pymanopt" ]; + nativeCheckInputs = [ + autograd + jax + matplotlib + pytestCheckHook + tensorflow + torch + ]; + + 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" + ]; + 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 ]; };