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