summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Kalinkin <dmitry.kalinkin@gmail.com>2022-07-26 16:26:18 -0400
committerDmitry Kalinkin <dmitry.kalinkin@gmail.com>2022-09-05 16:07:38 -0400
commitaa988f19ff60994c6b7ee5761479da1f7c771b01 (patch)
tree6a6a9beb5387e40ebb751164ad5a149fc71516a9
parentbb32e97a46920af7b91c62911ee6d440c0eab22a (diff)
python3Packages.pymoo: init at 0.6.0
-rw-r--r--pkgs/development/python-modules/pymoo/default.nix96
-rw-r--r--pkgs/top-level/python-packages.nix2
2 files changed, 98 insertions, 0 deletions
diff --git a/pkgs/development/python-modules/pymoo/default.nix b/pkgs/development/python-modules/pymoo/default.nix
new file mode 100644
index 000000000000..d2d0bdec81d4
--- /dev/null
+++ b/pkgs/development/python-modules/pymoo/default.nix
@@ -0,0 +1,96 @@
+{ lib
+, buildPythonPackage
+, fetchFromGitHub
+, pytestCheckHook
+, writeText
+, autograd
+, cma
+, cython
+, deprecated
+, dill
+, matplotlib
+, nbformat
+, notebook
+, numba
+, numpy
+, pandas
+, scipy
+}:
+
+buildPythonPackage rec {
+ pname = "pymoo";
+ version = "0.6.0";
+
+ src = fetchFromGitHub {
+ owner = "anyoptimization";
+ repo = "pymoo";
+ rev = version;
+ sha256 = "sha256-dzKr+u84XmPShWXFjH7V9KzwJPGZz3msGOe1S7FlGTQ=";
+ };
+
+ pymoo_data = fetchFromGitHub {
+ owner = "anyoptimization";
+ repo = "pymoo-data";
+ rev = "33f61a78182ceb211b95381dd6d3edee0d2fc0f3";
+ sha256 = "sha256-iGWPepZw3kJzw5HKV09CvemVvkvFQ38GVP+BAryBSs0=";
+ };
+
+ postPatch = ''
+ substituteInPlace setup.py \
+ --replace "cma==3.2.2" "cma" \
+ --replace "'alive-progress'," ""
+
+ substituteInPlace pymoo/util/display/display.py \
+ --replace "from pymoo.util.display.progress import ProgressBar" "" \
+ --replace "ProgressBar() if progress else None" \
+ "print('Missing alive_progress needed for progress=True!') if progress else None"
+ '';
+
+ nativeBuildInputs = [
+ cython
+ ];
+ propagatedBuildInputs = [
+ autograd
+ cma
+ deprecated
+ dill
+ matplotlib
+ numpy
+ scipy
+ ];
+
+ doCheck = true;
+ preCheck = ''
+ substituteInPlace pymoo/config.py \
+ --replace "https://raw.githubusercontent.com/anyoptimization/pymoo-data/main/" \
+ "file://$pymoo_data/"
+ '';
+ checkInputs = [
+ pytestCheckHook
+ nbformat
+ notebook
+ numba
+ ];
+ # Select some lightweight tests
+ pytestFlagsArray = [
+ "-m 'not long'"
+ ];
+ disabledTests = [
+ # ModuleNotFoundError: No module named 'pymoo.cython.non_dominated_sorting'
+ "test_fast_non_dominated_sorting"
+ "test_efficient_non_dominated_sort"
+ ];
+ # Avoid crashing sandboxed build on macOS
+ MATPLOTLIBRC=writeText "" ''
+ backend: Agg
+ '';
+
+ pythonImportsCheck = [ "pymoo" ];
+
+ meta = with lib; {
+ description = "Multi-objective Optimization in Python";
+ homepage = "https://pymoo.org/";
+ license = licenses.asl20;
+ maintainers = with maintainers; [ veprbl ];
+ };
+}
diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix
index 637f9640bd57..0e88b141da54 100644
--- a/pkgs/top-level/python-packages.nix
+++ b/pkgs/top-level/python-packages.nix
@@ -7986,6 +7986,8 @@ in {
pymongo = callPackage ../development/python-modules/pymongo { };
+ pymoo = callPackage ../development/python-modules/pymoo { };
+
pymorphy2 = callPackage ../development/python-modules/pymorphy2 { };
pymorphy2-dicts-ru = callPackage ../development/python-modules/pymorphy2/dicts-ru.nix { };