1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
|
{
lib,
stdenv,
buildPythonPackage,
fetchFromGitHub,
# build-system
cython,
setuptools,
# dependencies
alive-progress,
autograd,
cma,
deprecated,
matplotlib,
moocore,
numpy,
scipy,
# tests
jupytext,
nbformat,
notebook,
numba,
optuna,
pytestCheckHook,
pythonAtLeast,
scikit-learn,
writeText,
}:
let
pymoo_data = fetchFromGitHub {
owner = "anyoptimization";
repo = "pymoo-data";
rev = "8dae7d02078def161ee109184399adc3db25265b";
hash = "sha256-dpuRIMqDQ+oKrvK1VAQxPG6vijZMxT6MB8xOswPwv5o=";
};
in
buildPythonPackage rec {
pname = "pymoo";
version = "0.6.1.6";
pyproject = true;
src = fetchFromGitHub {
owner = "anyoptimization";
repo = "pymoo";
tag = version;
hash = "sha256-tLkXH0Ig/yWZbaFwzsdIdmbnlNd9UAruVSziaL3iW4U=";
};
postPatch = ''
substituteInPlace pymoo/util/display/display.py \
--replace-fail "from pymoo.util.display.progress import ProgressBar" "" \
--replace-fail \
"ProgressBar() if progress else None" \
"print('Missing alive_progress needed for progress=True!') if progress else None"
substituteInPlace pymoo/config.py \
--replace-fail \
"https://raw.githubusercontent.com/anyoptimization/pymoo-data/main/" \
"file://${pymoo_data}/"
'';
pythonRemoveDeps = [ "alive-progress" ];
build-system = [
setuptools
cython
];
dependencies = [
alive-progress
autograd
cma
deprecated
matplotlib
moocore
numpy
scipy
];
nativeCheckInputs = [
jupytext
nbformat
notebook
numba
optuna
pytestCheckHook
scikit-learn
];
# Select some lightweight tests
disabledTestMarks = [ "long" ];
disabledTests = [
# 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"
# AssertionError:
# Not equal to tolerance rtol=0, atol=0.0001
# Mismatched elements: 1200 / 1200 (100%)
"test_pf"
# TypeError: 'NoneType' object is not subscriptable
"test_dascomp"
"test_mw"
]
++ lib.optionals (pythonAtLeast "3.13") [
# AttributeError: 'ZDT3' object has no attribute 'elementwise'
"test_kktpm_correctness"
];
disabledTestPaths = [
# sensitive to float precision
"tests/algorithms/test_no_modfication.py"
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
# sensitive to float precision
"tests/misc/test_kktpm.py::test_kktpm_correctness[zdt3-params3]"
];
# Avoid crashing sandboxed build on macOS
env.MATPLOTLIBRC = writeText "" ''
backend: Agg
'';
pythonImportsCheck = [ "pymoo" ];
meta = {
description = "Multi-objective Optimization in Python";
homepage = "https://pymoo.org/";
downloadPage = "https://github.com/anyoptimization/pymoo";
changelog = "https://github.com/anyoptimization/pymoo/releases/tag/${src.tag}";
license = lib.licenses.asl20;
maintainers = with lib.maintainers; [ veprbl ];
};
}
|