nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 151 lines 3.2 kB view raw
1{ 2 lib, 3 stdenv, 4 buildPythonPackage, 5 fetchFromGitHub, 6 7 # build-system 8 setuptools, 9 10 # dependencies 11 alembic, 12 colorlog, 13 numpy, 14 packaging, 15 sqlalchemy, 16 tqdm, 17 pyyaml, 18 19 # optional-dependencies 20 boto3, 21 cmaes, 22 fvcore, 23 google-cloud-storage, 24 grpcio, 25 matplotlib, 26 pandas, 27 plotly, 28 protobuf, 29 redis, 30 scikit-learn, 31 scipy, 32 33 # tests 34 addBinToPathHook, 35 fakeredis, 36 kaleido, 37 moto, 38 pytest-xdist, 39 pytestCheckHook, 40 torch, 41 versionCheckHook, 42}: 43 44buildPythonPackage rec { 45 pname = "optuna"; 46 version = "4.7.0"; 47 pyproject = true; 48 49 src = fetchFromGitHub { 50 owner = "optuna"; 51 repo = "optuna"; 52 tag = "v${version}"; 53 hash = "sha256-SbEmJ4V4pyxMUx3GPMqBUDLq4AslwichbZNmNwmNm0o="; 54 }; 55 56 build-system = [ 57 setuptools 58 ]; 59 60 dependencies = [ 61 alembic 62 colorlog 63 numpy 64 packaging 65 sqlalchemy 66 tqdm 67 pyyaml 68 ]; 69 70 optional-dependencies = { 71 optional = [ 72 boto3 73 cmaes 74 fvcore 75 google-cloud-storage 76 grpcio 77 matplotlib 78 pandas 79 plotly 80 protobuf 81 redis 82 scikit-learn 83 scipy 84 ]; 85 }; 86 87 preCheck = 88 # grpc tests are racy 89 '' 90 sed -i '/"grpc",/d' optuna/testing/storages.py 91 '' 92 # Prevents 'Fatal Python error: Aborted' on darwin during checkPhase 93 + lib.optionalString stdenv.hostPlatform.isDarwin '' 94 export MPLBACKEND="Agg" 95 ''; 96 97 nativeCheckInputs = [ 98 addBinToPathHook 99 fakeredis 100 kaleido 101 moto 102 pytest-xdist 103 pytestCheckHook 104 torch 105 versionCheckHook 106 ] 107 ++ fakeredis.optional-dependencies.lua 108 ++ optional-dependencies.optional; 109 110 disabledTests = [ 111 # ValueError: Transform failed with error code 525: error creating static canvas/context for image server 112 "test_get_pareto_front_plot" 113 # too narrow time limit 114 "test_get_timeline_plot_with_killed_running_trials" 115 # times out under load 116 "test_optimize_with_progbar_timeout" 117 ] 118 ++ lib.optionals stdenv.hostPlatform.isDarwin [ 119 # ValueError: Failed to start Kaleido subprocess. Error stream 120 # kaleido/executable/kaleido: line 5: 5956 Illegal instruction: 4 ./bin/kaleido $@ 121 "test_get_optimization_history_plot" 122 "test_plot_intermediate_values" 123 "test_plot_rank" 124 "test_plot_terminator_improvement" 125 ]; 126 127 disabledTestPaths = lib.optionals stdenv.hostPlatform.isDarwin [ 128 # PermissionError: [Errno 13] Permission denied: '/tmp/optuna_find_free_port.lock' 129 "tests/storages_tests/journal_tests/test_combination_with_grpc.py" 130 "tests/storages_tests/test_grpc.py" 131 "tests/storages_tests/test_storages.py" 132 "tests/study_tests/test_dataframe.py" 133 "tests/study_tests/test_optimize.py" 134 "tests/study_tests/test_study.py" 135 "tests/trial_tests/test_frozen.py" 136 "tests/trial_tests/test_trial.py" 137 ]; 138 139 __darwinAllowLocalNetworking = true; 140 141 pythonImportsCheck = [ "optuna" ]; 142 143 meta = { 144 description = "Hyperparameter optimization framework"; 145 homepage = "https://optuna.org/"; 146 changelog = "https://github.com/optuna/optuna/releases/tag/${src.tag}"; 147 license = lib.licenses.mit; 148 maintainers = with lib.maintainers; [ natsukium ]; 149 mainProgram = "optuna"; 150 }; 151}