forked from PKU-DAIR/open-box
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
74 lines (64 loc) · 2.25 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
#!/usr/bin/env python
# This en code is licensed under the MIT license found in the
# LICENSE file in the root directory of this en tree.
import sys
import importlib.util
from pathlib import Path
from distutils.core import setup
from setuptools import find_packages
requirements = dict()
for extra in ["dev", "main"]:
# Skip `package @ git+[repo_url]` because not supported by pypi
if (3, 6) <= sys.version_info < (3, 7):
requirements[extra] = [r
for r in Path("requirements/%s_py36.txt" % extra).read_text().splitlines()
if '@' not in r
]
else:
requirements[extra] = [r
for r in Path("requirements/%s.txt" % extra).read_text().splitlines()
if '@' not in r
]
# Find version number
spec = importlib.util.spec_from_file_location("openbox.pkginfo", str(Path(__file__).parent / "openbox" / "pkginfo.py"))
pkginfo = importlib.util.module_from_spec(spec)
spec.loader.exec_module(pkginfo)
version = pkginfo.version
package_name = pkginfo.package_name
# Get the platform info.
def get_platform():
platforms = {
'linux': 'Linux',
'linux1': 'Linux',
'linux2': 'Linux',
'darwin': 'OSX',
'win32': 'Windows'
}
if sys.platform not in platforms:
raise ValueError('Unsupported platform - %s.' % sys.platform)
return platforms[sys.platform]
platform = get_platform()
# Get readme strings.
def readme() -> str:
return open("README.md", encoding='utf-8').read()
setup(
name=package_name,
version=version,
description="Efficient and generalized blackbox optimization (BBO) system",
long_description=readme(),
long_description_content_type="text/markdown",
url='https://github.com/PKU-DAIR/open-box',
author="Thomas (Yang) Li from DAIR Lab@PKU",
packages=find_packages(),
license="MIT",
install_requires=requirements["main"],
extras_require={"dev": requirements["dev"]},
package_data={"open-box": ["py.typed"]},
include_package_data=True,
python_requires='>=3.6.0',
entry_points={
"console_scripts": [
"openbox = openbox.__main__:main",
]
}
)