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