-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
135 lines (117 loc) · 3.49 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
"""wheel setup for Prosper common utilities"""
import codecs
import importlib
import os
from setuptools import setup, find_packages
from setuptools.command.test import test as TestCommand
HERE = os.path.abspath(os.path.dirname(__file__))
__package_name__ = 'vincent'
__library_name__ = 'vincent-lexicon'
def get_version(package_name):
"""find __version__ for making package
Args:
package_name (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
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'),
('secret-cfg=', None, 'Secret credentials.ini file to apply to app.cfg'),
]
def initialize_options(self):
TestCommand.initialize_options(self)
self.secret_cfg = None
self.pytest_args = [
'tests',
'-rx',
'--cov=' + __package_name__,
'--cov=' + __package_name__ + '_crons',
'--cov-report=term-missing',
'--cov-config=.coveragerc',
]
def run_tests(self):
import shlex
import pytest
pytest_commands = []
if self.secret_cfg:
pytest_commands.append('--secret-cfg=' + self.secret_cfg)
try:
pytest_commands.extend(shlex.split(self.pytest_args))
except AttributeError:
pytest_commands = self.pytest_args
errno = pytest.main(pytest_commands)
exit(errno)
class TravisTest(PyTest):
"""wrapper for quick-testing for devs"""
def initialize_options(self):
TestCommand.initialize_options(self)
self.secret_cfg = None
self.pytest_args = [
'tests',
'-rx',
'--junitxml=junit.xml',
'--cov=' + __package_name__,
'--cov=' + __package_name__ + '_crons',
'--cov-report=term-missing',
'--cov-config=.coveragerc',
]
with codecs.open('README.rst', 'r', 'utf-8') as readme_fh:
README = readme_fh.read()
setup(
name=__library_name__,
version=get_version(__package_name__),
description='NLP sentiment analysis for corperate-speak',
long_description=README,
author='John Purcell',
author_email='[email protected]',
url='https://github.com/EVEProsper/' + __library_name__,
license='MIT',
classifiers=[
'Programming Language :: Python :: 3.6',
],
packages=find_packages(),
python_requires='>=3.6',
include_package_data=True,
package_data={
'': ['LICENSE', 'README.rst'],
__library_name__: ['version.txt'],
'vincent_crons': ['app.cfg'],
},
entry_points={
'console_scripts': [
'GetNews=vincent_crons.GetNews:run_main',
],
},
install_requires=[
'nltk',
'pandas',
'ProsperCommon',
'ProsperDatareader',
'plumbum',
'requests',
],
tests_require=[
'pytest',
'pytest_cov',
],
extras_require={
'dev':[
'sphinx',
'sphinxcontrib-napoleon',
'semantic-version',
'awscli',
]
},
cmdclass={
'test':PyTest,
'travis': TravisTest,
},
)