1{ lib
2, buildPythonPackage
3, fetchFromGitHub
4, pytestCheckHook
5, writeText
6, autograd
7, cma
8, cython
9, deprecated
10, dill
11, matplotlib
12, nbformat
13, notebook
14, numba
15, numpy
16, pandas
17, scipy
18}:
19
20buildPythonPackage rec {
21 pname = "pymoo";
22 version = "0.6.0";
23
24 src = fetchFromGitHub {
25 owner = "anyoptimization";
26 repo = "pymoo";
27 rev = version;
28 sha256 = "sha256-dzKr+u84XmPShWXFjH7V9KzwJPGZz3msGOe1S7FlGTQ=";
29 };
30
31 pymoo_data = fetchFromGitHub {
32 owner = "anyoptimization";
33 repo = "pymoo-data";
34 rev = "33f61a78182ceb211b95381dd6d3edee0d2fc0f3";
35 sha256 = "sha256-iGWPepZw3kJzw5HKV09CvemVvkvFQ38GVP+BAryBSs0=";
36 };
37
38 postPatch = ''
39 substituteInPlace setup.py \
40 --replace "cma==3.2.2" "cma" \
41 --replace "'alive-progress'," ""
42
43 substituteInPlace pymoo/util/display/display.py \
44 --replace "from pymoo.util.display.progress import ProgressBar" "" \
45 --replace "ProgressBar() if progress else None" \
46 "print('Missing alive_progress needed for progress=True!') if progress else None"
47 '';
48
49 nativeBuildInputs = [
50 cython
51 ];
52 propagatedBuildInputs = [
53 autograd
54 cma
55 deprecated
56 dill
57 matplotlib
58 numpy
59 scipy
60 ];
61
62 doCheck = true;
63 preCheck = ''
64 substituteInPlace pymoo/config.py \
65 --replace "https://raw.githubusercontent.com/anyoptimization/pymoo-data/main/" \
66 "file://$pymoo_data/"
67 '';
68 checkInputs = [
69 pytestCheckHook
70 nbformat
71 notebook
72 numba
73 ];
74 # Select some lightweight tests
75 pytestFlagsArray = [
76 "-m 'not long'"
77 ];
78 disabledTests = [
79 # ModuleNotFoundError: No module named 'pymoo.cython.non_dominated_sorting'
80 "test_fast_non_dominated_sorting"
81 "test_efficient_non_dominated_sort"
82 ];
83 # Avoid crashing sandboxed build on macOS
84 MATPLOTLIBRC=writeText "" ''
85 backend: Agg
86 '';
87
88 pythonImportsCheck = [ "pymoo" ];
89
90 meta = with lib; {
91 description = "Multi-objective Optimization in Python";
92 homepage = "https://pymoo.org/";
93 license = licenses.asl20;
94 maintainers = with maintainers; [ veprbl ];
95 };
96}