-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding prosper common project shape to template
- Loading branch information
Showing
20 changed files
with
200 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -80,3 +80,6 @@ target/ | |
|
||
# Mac OS-specific storage files | ||
.DS_Store | ||
|
||
# Secrets | ||
credentials.cfg |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,138 @@ | ||
from setuptools import find_packages, setup | ||
"""wheel setup for Prosper common utilities""" | ||
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__ = 'vincent' | ||
__library_name__ = 'vincent-lexicon' | ||
|
||
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', | ||
'--cov=' + __library_name__, | ||
'--cov-report=term-missing', | ||
'--cov-config=.coveragerc', | ||
] | ||
|
||
def run_tests(self): | ||
import shlex | ||
import pytest | ||
pytest_commands = [] | ||
try: | ||
pytest_commands = 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.pytest_args = [ | ||
'tests', | ||
'-rx', | ||
'--junitxml=junit.xml', | ||
'--cov=' + __library_name__, | ||
'--cov-report=term-missing', | ||
'--cov-config=.coveragerc', | ||
] | ||
setup( | ||
name='src', | ||
packages=find_packages(), | ||
version='0.0.1', | ||
name=__library_name__, | ||
version=get_version(__package_name__), | ||
description='NLP sentiment analysis for corperate-speak', | ||
author='John Purcell', | ||
author_email='[email protected]', | ||
url='https://github.com/EVEProsper/' + __package_name__, | ||
license='MIT', | ||
classifiers=[ | ||
'Programming Language :: Python :: 3.6', | ||
], | ||
packages=find_packages(), | ||
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=[ | ||
'ProsperCommon', | ||
'plumbum', | ||
'requests', | ||
], | ||
tests_require=[ | ||
'pytest', | ||
'pytest_cov', | ||
], | ||
extras_require={ | ||
'dev':[ | ||
'sphinx', | ||
'sphinxcontrib-napoleon', | ||
'semantic-version', | ||
'awscli', | ||
] | ||
}, | ||
cmdclass={ | ||
'test':PyTest, | ||
'travis': TravisTest, | ||
}, | ||
) |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
"""_version.py: track package version information""" | ||
from os import path | ||
import warnings | ||
|
||
INSTALLED = True | ||
try: # pragma: no cover | ||
import prosper.common.prosper_version as p_version | ||
except ImportError: | ||
INSTALLED = False | ||
|
||
HERE = path.abspath(path.dirname(__file__)) | ||
PROGNAME = 'TestHelpers' | ||
|
||
def get_version(): | ||
"""find current version information | ||
Returns: | ||
str: version information | ||
""" | ||
if not INSTALLED: | ||
try: | ||
with open('version.txt', 'r') as v_fh: | ||
return v_fh.read() | ||
except Exception: | ||
warnings.warn( | ||
'Unable to resolve package version until installed', | ||
UserWarning | ||
) | ||
return '0.0.0' # can't parse version without stuff installed | ||
|
||
return p_version.get_version(HERE) | ||
|
||
__version__ = get_version() |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
"""launcher/wrapper for executing CLI""" | ||
from os import path | ||
import platform | ||
import logging | ||
|
||
from plumbum import cli | ||
|
||
import prosper.common.prosper_cli as p_cli | ||
import prosper.common.prosper_logging as p_logging | ||
import prosper.common.prosper_config as p_config | ||
|
||
from vincent import _version | ||
|
||
HERE = path.abspath(path.dirname(__file__)) | ||
|
||
class GetNewsCLI(p_cli.ProsperApplication): | ||
PROGNAME = _version.PROGNAME | ||
VERSION = _version.__version__ | ||
|
||
config_path = path.join(HERE, 'app.cfg') | ||
|
||
def main(self): | ||
"""launcher logic""" | ||
self.logger.info('hello world') | ||
|
||
def run_main(): | ||
"""entry point for launching app""" | ||
GetNewsCLI.run() | ||
|
||
if __name__ == '__main__': | ||
run_main() |
Empty file.