-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
84 lines (68 loc) · 1.97 KB
/
setup.py
File metadata and controls
84 lines (68 loc) · 1.97 KB
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
import os
import sys
from pathlib import Path
import tensorflow as tf
from setuptools import (
find_packages,
setup,
Command,
)
# Package meta-data.
NAME = 'trainer'
DESCRIPTION = 'Trainer powered by cloud ml'
REQUIRED = [
'tensorflow-gpu==1.13.*' if tf.test.is_gpu_available() else 'tensorflow==1.13.*',
'tensorflow-model-analysis==0.13.*'
]
EXTRAS = dict(
dev=[
'pytest==4.2.*',
'pytest-cov==2.6.*',
'pytest-mock==1.10.*',
'pytest-xdist==1.26.*',
'tox==3.7.*',
],
)
# Load the package's __version__.py module as a directory.
about = {}
project_slug = NAME.lower().replace('-', '_').replace(' ', '_')
with open(str(Path('{}/{}'.format(project_slug, '__version__.py')).resolve())) as f:
exec(f.read(), about)
class ReleaseCommand(Command):
"""ref. https://github.com/kennethreitz/setup.py/blob/master/setup.py"""
user_options = []
@staticmethod
def status(s):
"""Prints things in bold."""
print('\033[1m{0}\033[0m'.format(s))
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
try:
self.status('Removing previous builds...')
Path('dist').rmdir()
except OSError:
pass
self.status('Building Source and Wheel (universal) distribution...')
os.system('{} setup.py sdist bdist_wheel --universal'.format(sys.executable))
self.status('Pushing git tags...')
os.system('git tag v{}'.format(about['__version__']))
os.system('git push --tags')
sys.exit()
# Where the magic happens:
setup(
name=NAME,
version=about['__version__'],
description=DESCRIPTION,
packages=find_packages(exclude=['tests', '*.tests', '*.tests.*', 'tests.*']),
python_requires='==3.5.*',
install_requires=REQUIRED,
extras_require=EXTRAS,
include_package_data=True,
license='MIT',
cmdclass=dict(
release=ReleaseCommand,
),
)