-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
154 lines (130 loc) · 4.05 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
"""wheel setup for slash-coins"""
from codecs import open
import importlib
from os import path, listdir
from setuptools import setup, find_packages
from setuptools.command.test import test as TestCommand
HERE = path.abspath(path.dirname(__file__))
__package_name__ = 'slash-coins'
__library_name__ = 'slash_coins'
def get_version(package_name):
"""find __version__ for making package
Args:
package_path (str): path to _version.py folder (abspath > relpath)
Returns:
(str) __version__ value
"""
module = package_name + '._version'
package = importlib.import_module(module)
version = package.__version__
return version
def include_all_subfiles(*args):
"""Slurps up all files in a directory (non recursive) for data_files section
Note:
Not recursive, only includes flat files
Returns:
(:obj:`list` :obj:`str`) list of all non-directories in a file
"""
file_list = []
for path_included in args:
local_path = path.join(HERE, path_included)
for file in listdir(local_path):
file_abspath = path.join(local_path, file)
if path.isdir(file_abspath): #do not include sub folders
continue
file_list.append(path_included + '/' + file)
return file_list
class PyTest(TestCommand):
"""PyTest cmdclass hook for test-at-buildtime functionality
http://doc.pytest.org/en/latest/goodpractices.html#manual-integration
"""
user_options = [('pytest-args=', 'a', "Arguments to pass to pytest")]
def initialize_options(self):
TestCommand.initialize_options(self)
self.pytest_args = [
'tests',
'-rx',
'-m', 'not docker',
'--cov=' + __library_name__,
'--cov-report=term-missing',
'--cov-config=.coveragerc'
] #load defaults here
def run_tests(self):
import shlex
#import here, cause outside the eggs aren't loaded
import pytest
pytest_commands = []
try: #read commandline
pytest_commands = shlex.split(self.pytest_args)
except AttributeError: #use defaults
pytest_commands = self.pytest_args
errno = pytest.main(pytest_commands)
exit(errno)
class TravisTest(PyTest):
"""wrapper for running travis with extra modes"""
def initialize_options(self):
TestCommand.initialize_options(self)
self.pytest_args = [
'tests',
'-rx',
'--cov=' + __library_name__,
'--cov-report=term-missing',
'--cov-config=.coveragerc'
]
with open('README.rst', 'r', 'utf-8') as f:
README = f.read()
setup(
name=__package_name__,
description='Chat /command REST API For CryptoCoin Quotes',
version=get_version(__library_name__),
long_description=README,
author='John Purcell',
author_email='[email protected]',
url='https://github.com/lockefox/' + __package_name__,
license='MIT',
classifiers=[
'Programming Language :: Python :: 3.6',
],
keywords='prosper flask rest hipchat cryptocurrency integration',
packages=find_packages(),
include_package_data=True,
data_files=[
('docs', include_all_subfiles('docs')),
],
package_data={
'': ['LICENSE', 'README.rst', 'changelog'],
'slash_coins': ['version.txt', 'app.cfg']
},
entry_points={
'console_scripts': [
'slash_coin_launcher=slash_coins.flask_launcher:run_main'
]
},
install_requires=[
'ProsperCommon==1.3.0a0',
'ProsperDatareader[nltk]>=2.0.0',
'Flask',
'Flask-RESTful',
'plumbum',
'pandas',
'numpy',
'requests',
],
tests_require=[
'pytest',
'pytest_cov',
'pytest-flask',
'shortuuid',
'jsonschema',
],
extras_require={
'dev':[
'sphinx',
'sphinxcontrib-napoleon',
]
},
cmdclass={
'test':PyTest,
'travis_test': TravisTest,
}
)