about summary refs log tree commit diff
diff options
context:
space:
mode:
authorWeijia Wang2024-11-14 20:45:49 +0100
committerGitHub2024-11-14 20:45:49 +0100
commit0a533d355e92b256a315d34350b7088eeef5e069 (patch)
treed1c917537b45eea84884fa0ab54bc36f6cf640dd
parent9ef90b4a8ae85886760f85cc5ecc32b121b737f9 (diff)
parentc3892dbf3af3436078d5f98a2f69a17b8496462e (diff)
[Backport release-24.11] python312Packages.pymoo: drop patch, fix tests, unbreak (#355972)
-rw-r--r--pkgs/development/python-modules/pymoo/default.nix21
1 files changed, 12 insertions, 9 deletions
diff --git a/pkgs/development/python-modules/pymoo/default.nix b/pkgs/development/python-modules/pymoo/default.nix
index 86eb3e81b294..4456319b4349 100644
--- a/pkgs/development/python-modules/pymoo/default.nix
+++ b/pkgs/development/python-modules/pymoo/default.nix
@@ -2,7 +2,6 @@
   lib,
   buildPythonPackage,
   fetchFromGitHub,
-  fetchpatch,
   setuptools,
   pytestCheckHook,
   writeText,
@@ -38,14 +37,6 @@ buildPythonPackage rec {
     hash = "sha256-iGWPepZw3kJzw5HKV09CvemVvkvFQ38GVP+BAryBSs0=";
   };
 
-  patches = [
-    # https://github.com/anyoptimization/pymoo/pull/407
-    (fetchpatch {
-      url = "https://github.com/anyoptimization/pymoo/commit/be57ece64275469daece1e8ef12b2b6ee05362c9.diff";
-      hash = "sha256-BLPrUqNbAsAecfYahESEJF6LD+kehUYmkTvl/nvyqII=";
-    })
-  ];
-
   pythonRelaxDeps = [ "cma" ];
   pythonRemoveDeps = [ "alive-progress" ];
 
@@ -74,6 +65,10 @@ buildPythonPackage rec {
     substituteInPlace pymoo/config.py \
       --replace-fail "https://raw.githubusercontent.com/anyoptimization/pymoo-data/main/" \
                 "file://$pymoo_data/"
+
+    # Some tests require a grad backend to be configured, this is a hacky way to do so.
+    # The choice must be either "jax.numpy" or "autograd.numpy"
+    echo 'from pymoo.gradient import activate; activate("autograd.numpy")' >> tests/conftest.py
   '';
   nativeCheckInputs = [
     pytestCheckHook
@@ -87,6 +82,14 @@ buildPythonPackage rec {
     # ModuleNotFoundError: No module named 'pymoo.cython.non_dominated_sorting'
     "test_fast_non_dominated_sorting"
     "test_efficient_non_dominated_sort"
+    "test_dominance_degree_non_dominated_sort"
+
+    # sensitive to float precision
+    "test_cd_and_pcd"
+  ];
+  disabledTestPaths = [
+    # sensitive to float precision
+    "tests/algorithms/test_no_modfication.py"
   ];
   # Avoid crashing sandboxed build on macOS
   MATPLOTLIBRC = writeText "" ''