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