-
Notifications
You must be signed in to change notification settings - Fork 6
/
setup.py
76 lines (67 loc) · 2.15 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
#!/usr/bin/env python
import subprocess as sp
from contextlib import contextmanager
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
@contextmanager
def set_version():
# get __version__
exec(open('azalea/version.py').read())
version = locals()['__version__']
if 'dev' in version and '+' not in version:
# append git hash
proc = sp.run(['git', 'rev-parse', 'HEAD'],
stdout=sp.PIPE, stderr=sp.DEVNULL)
if proc.stdout:
git_rev = proc.stdout.decode().strip()
version = f'{version}+{git_rev[:7]}'
with open('azalea/version.py', 'w') as f:
f.write(f"__version__ = '{version}'\n")
try:
yield version
finally:
# restore default version.py
sp.run(['git', 'checkout', '--', 'azalea/version.py'],
stderr=sp.DEVNULL)
with open("README.md", "r", encoding='utf-8') as fh:
long_description = fh.read()
with set_version() as version:
setup(
name='azalea',
version=version,
license='Apache-2.0',
description='Hex board game AI with self-play learning based on the AlphaZero algorithm',
long_description=long_description,
long_description_content_type='text/markdown',
author='Jarno Seppänen',
author_email='azalea@meit.si',
url='https://github.com/jseppanen/azalea',
packages=[
'azalea',
'azalea.game',
'azalea.typing',
],
install_requires=[
'numba',
'numpy',
'torch',
'scipy',
'pyyaml',
'click',
'tensorboardX',
],
entry_points={
'console_scripts': [
'azalea-compare = azalea.compare_cli:main',
'azalea-play = azalea.play_cli:main',
]
},
classifiers=[
"Programming Language :: Python :: 3",
"License :: OSI Approved :: Apache Software License",
"Operating System :: POSIX :: Linux",
"Operating System :: OS Independent",
],
)