1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 pytestCheckHook,
6 pythonOlder,
7 alembic,
8 boto3,
9 botorch,
10 catboost,
11 cma,
12 cmaes,
13 colorlog,
14 distributed,
15 fakeredis,
16 google-cloud-storage,
17 lightgbm,
18 matplotlib,
19 mlflow,
20 moto,
21 numpy,
22 packaging,
23 pandas,
24 plotly,
25 pytest-xdist,
26 pytorch-lightning,
27 pyyaml,
28 redis,
29 scikit-learn,
30 scipy,
31 setuptools,
32 shap,
33 sqlalchemy,
34 tensorflow,
35 torch,
36 torchaudio,
37 torchvision,
38 tqdm,
39 wandb,
40 xgboost,
41}:
42
43buildPythonPackage rec {
44 pname = "optuna";
45 version = "4.1.0";
46 pyproject = true;
47
48 disabled = pythonOlder "3.8";
49
50 src = fetchFromGitHub {
51 owner = "optuna";
52 repo = "optuna";
53 rev = "refs/tags/v${version}";
54 hash = "sha256-wIgYExxJEWFxEadBuCsxEIcW2/J6EVybW1jp83gIMjY=";
55 };
56
57 build-system = [
58 setuptools
59 ];
60
61 dependencies = [
62 alembic
63 colorlog
64 numpy
65 packaging
66 sqlalchemy
67 tqdm
68 pyyaml
69 ];
70
71 optional-dependencies = {
72 integration = [
73 botorch
74 catboost
75 cma
76 distributed
77 lightgbm
78 mlflow
79 pandas
80 # pytorch-ignite
81 pytorch-lightning
82 scikit-learn
83 shap
84 tensorflow
85 torch
86 torchaudio
87 torchvision
88 wandb
89 xgboost
90 ];
91 optional = [
92 boto3
93 botorch
94 cmaes
95 google-cloud-storage
96 matplotlib
97 pandas
98 plotly
99 redis
100 scikit-learn
101 ];
102 };
103
104 preCheck = ''
105 export PATH=$out/bin:$PATH
106 '';
107
108 nativeCheckInputs =
109 [
110 fakeredis
111 moto
112 pytest-xdist
113 pytestCheckHook
114 scipy
115 ]
116 ++ fakeredis.optional-dependencies.lua
117 ++ optional-dependencies.optional;
118
119 pytestFlagsArray = [ "-m 'not integration'" ];
120
121 disabledTestPaths = [
122 # require unpackaged kaleido and building it is a bit difficult
123 "tests/visualization_tests"
124 # ImportError: cannot import name 'mock_s3' from 'moto'
125 "tests/artifacts_tests/test_boto3.py"
126 ];
127
128 pythonImportsCheck = [ "optuna" ];
129
130 meta = with lib; {
131 description = "Hyperparameter optimization framework";
132 homepage = "https://optuna.org/";
133 changelog = "https://github.com/optuna/optuna/releases/tag/${version}";
134 license = licenses.mit;
135 maintainers = with maintainers; [ natsukium ];
136 mainProgram = "optuna";
137 };
138}