Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at gcc-offload 107 lines 2.6 kB view raw
1{ 2 lib, 3 buildPythonPackage, 4 fetchFromGitHub, 5 setuptools, 6 pytestCheckHook, 7 writeText, 8 autograd, 9 cma, 10 cython, 11 deprecated, 12 dill, 13 matplotlib, 14 nbformat, 15 notebook, 16 numba, 17 numpy, 18 scipy, 19}: 20 21buildPythonPackage rec { 22 pname = "pymoo"; 23 version = "0.6.1.3"; 24 pyproject = true; 25 26 src = fetchFromGitHub { 27 owner = "anyoptimization"; 28 repo = "pymoo"; 29 rev = "refs/tags/${version}"; 30 hash = "sha256-CbeJwv51lu4cABgGieqy/8DCDJCb8wOPPVqUHk8Jb7E="; 31 }; 32 33 pymoo_data = fetchFromGitHub { 34 owner = "anyoptimization"; 35 repo = "pymoo-data"; 36 rev = "33f61a78182ceb211b95381dd6d3edee0d2fc0f3"; 37 hash = "sha256-iGWPepZw3kJzw5HKV09CvemVvkvFQ38GVP+BAryBSs0="; 38 }; 39 40 pythonRelaxDeps = [ "cma" ]; 41 pythonRemoveDeps = [ "alive-progress" ]; 42 43 postPatch = '' 44 substituteInPlace pymoo/util/display/display.py \ 45 --replace-fail "from pymoo.util.display.progress import ProgressBar" "" \ 46 --replace-fail "ProgressBar() if progress else None" \ 47 "print('Missing alive_progress needed for progress=True!') if progress else None" 48 ''; 49 50 build-system = [ 51 setuptools 52 cython 53 ]; 54 dependencies = [ 55 autograd 56 cma 57 deprecated 58 dill 59 matplotlib 60 numpy 61 scipy 62 ]; 63 64 preCheck = '' 65 substituteInPlace pymoo/config.py \ 66 --replace-fail "https://raw.githubusercontent.com/anyoptimization/pymoo-data/main/" \ 67 "file://$pymoo_data/" 68 69 # Some tests require a grad backend to be configured, this is a hacky way to do so. 70 # The choice must be either "jax.numpy" or "autograd.numpy" 71 echo 'from pymoo.gradient import activate; activate("autograd.numpy")' >> tests/conftest.py 72 ''; 73 nativeCheckInputs = [ 74 pytestCheckHook 75 nbformat 76 notebook 77 numba 78 ]; 79 # Select some lightweight tests 80 pytestFlagsArray = [ "-m 'not long'" ]; 81 disabledTests = [ 82 # ModuleNotFoundError: No module named 'pymoo.cython.non_dominated_sorting' 83 "test_fast_non_dominated_sorting" 84 "test_efficient_non_dominated_sort" 85 "test_dominance_degree_non_dominated_sort" 86 87 # sensitive to float precision 88 "test_cd_and_pcd" 89 ]; 90 disabledTestPaths = [ 91 # sensitive to float precision 92 "tests/algorithms/test_no_modfication.py" 93 ]; 94 # Avoid crashing sandboxed build on macOS 95 MATPLOTLIBRC = writeText "" '' 96 backend: Agg 97 ''; 98 99 pythonImportsCheck = [ "pymoo" ]; 100 101 meta = with lib; { 102 description = "Multi-objective Optimization in Python"; 103 homepage = "https://pymoo.org/"; 104 license = licenses.asl20; 105 maintainers = with maintainers; [ veprbl ]; 106 }; 107}