-
Notifications
You must be signed in to change notification settings - Fork 1
/
setup.py
168 lines (144 loc) · 4.35 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
import os
import sys
import pkg_resources
from setuptools import find_packages
from setuptools import setup
from typing import Dict # NOQA
from typing import List # NOQA
from typing import Optional # NOQA
def get_version():
# type: () -> str
version_filepath = os.path.join(os.path.dirname(__file__), 'optuna', 'version.py')
with open(version_filepath) as f:
for line in f:
if line.startswith('__version__'):
return line.strip().split()[-1][1:-1]
assert False
def get_long_description():
# type: () -> str
readme_filepath = os.path.join(os.path.dirname(__file__), 'README.md')
with open(readme_filepath) as f:
return f.read()
def get_install_requires():
# type: () -> List[str]
return [
'alembic',
'cliff',
'colorlog',
'numpy',
# TODO(Yanase): Remove the version constraint when the CI error is solved by new versions.
# See https://github.com/optuna/optuna/issues/800 for further details.
'scipy<1.4.0',
'sqlalchemy>=1.1.0',
'tqdm',
'typing',
'joblib',
]
def get_tests_require():
# type: () -> List[str]
return get_extras_require()['testing']
def get_extras_require():
# type: () -> Dict[str, List[str]]
requirements = {
'checking': [
'autopep8',
'hacking',
'mypy',
],
'codecov': [
'codecov',
'pytest-cov',
],
'doctest': [
'pandas',
'scikit-learn>=0.19.0',
],
'document': [
'lightgbm',
'sphinx',
'sphinx_rtd_theme',
],
'example': [
'catboost',
'chainer',
'lightgbm',
'mlflow',
'mxnet',
'scikit-image',
'scikit-learn',
'xgboost',
] + (['fastai<2'] if (3, 5) < sys.version_info[:2] < (3, 8) else [])
+ ([
'dask[dataframe]',
'dask-ml',
'keras',
'pytorch-ignite',
'pytorch-lightning',
# TODO(Yanase): Update examples to support TensorFlow 2.0.
# See https://github.com/optuna/optuna/issues/565 for further details.
'tensorflow<2.0.0',
'torch',
'torchvision'
] if sys.version_info[:2] < (3, 8) else []),
'testing': [
'bokeh',
'chainer>=5.0.0',
'cma',
'lightgbm',
'mock',
'mpi4py',
'mxnet',
'pandas',
'plotly>=4.0.0',
'pytest',
'scikit-learn>=0.19.0',
'scikit-optimize',
'xgboost',
] + (['fastai<2'] if (3, 5) < sys.version_info[:2] < (3, 8) else [])
+ ([
'keras',
'pytorch-ignite',
'pytorch-lightning',
'tensorflow',
'tensorflow-datasets',
'torch',
'torchvision'
] if sys.version_info[:2] < (3, 8) else []),
}
return requirements
def find_any_distribution(pkgs):
# type: (List[str]) -> Optional[pkg_resources.Distribution]
for pkg in pkgs:
try:
return pkg_resources.get_distribution(pkg)
except pkg_resources.DistributionNotFound:
pass
return None
pfnopt_pkg = find_any_distribution(['pfnopt'])
if pfnopt_pkg is not None:
msg = 'We detected that PFNOpt is installed in your environment.\n' \
'PFNOpt has been renamed Optuna. Please uninstall the old\n' \
'PFNOpt in advance (e.g. by executing `$ pip uninstall pfnopt`).'
print(msg)
exit(1)
setup(
name='optuna',
version=get_version(),
description='A hyperparameter optimization framework',
long_description=get_long_description(),
long_description_content_type='text/markdown',
author='Takuya Akiba',
author_email='akiba@preferred.jp',
url='https://optuna.org/',
packages=find_packages(),
package_data={
'optuna': [
'storages/rdb/alembic.ini',
'storages/rdb/alembic/*.*',
'storages/rdb/alembic/versions/*.*'
]
},
install_requires=get_install_requires(),
tests_require=get_tests_require(),
extras_require=get_extras_require(),
entry_points={'console_scripts': ['optuna = optuna.cli:main']})