This repository has been archived by the owner on Jun 21, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsetup.py
119 lines (99 loc) · 3.29 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
# -*- coding: utf-8 -*-
"""
trendpy
-----
trendpy is a trend filtering microframework
trendpy implements L1 filtering solved by MCMC methods
-----
Links
-----
* `website`:
* `documentation`:
"""
import os
import sys
from setuptools import setup, find_packages
from distutils.sysconfig import get_python_lib
from configparser import ConfigParser
config_file = os.path.join(os.path.dirname(__file__), 'setup.cfg')
if "install" in sys.argv:
lib_paths = [get_python_lib()]
if lib_paths[0].startswith("/usr/lib/"):
lib_paths.append(get_python_lib(prefix="/usr/local"))
for lib_path in lib_paths:
existing_path = os.path.abspath(os.path.join(lib_path, "trendpy"))
def get_version_info():
"""
get_version_info
------------
gets software version infos from
"""
config=ConfigParser()
config.read(config_file)
MAJOR=config['version']['major']
MINOR=config['version']['minor']
MICRO=config['version']['micro']
ISRELEASED = True
VERSION = '%s.%s.%s' % (MAJOR, MINOR, MICRO)
return VERSION, ISRELEASED
def write_version_py(filename="version.py"):
"""
write_version_py
------------
write software version infos in version.py file
"""
file_content = """
# FILE CONTENT GENERATED FROM SETUP.PY
short_version = '%(version)s'
version = '%(version)s'
full_version = '%(full_version)s'
release = %(isrelease)s
if not release:
version = full_version
"""
filename = os.path.join(os.path.dirname(__file__), 'trendpy/%s' % filename)
VERSION, ISRELEASED = get_version_info()
_file = open(filename,'w+')
try:
_file.write(file_content % {'version': VERSION,
'full_version' : VERSION,
'isrelease': str(ISRELEASED)})
finally:
_file.close()
def setup_package():
_version, _isReleased = get_version_info()
write_version_py()
setup(name = 'trendpy',
version = str(_version),
description = 'Trend Filtering Python Micro Framework',
author = 'Rene-Jean Corneille',
author_email = '[email protected]',
license = 'MIT',
keywords = ['trend', 'finance', 'pandas', 'seaborn', 'filter', 'trading', 'stocks', 'equities', 'forex'],
url = 'https://github.com/RonsenbergVI/trendpy',
zip_safe = False,
include_package_data = True,
platforms = 'any',
packages=['trendpy'],
install_requires = ['numpy',
'scipy',
'pandas',
'seaborn',
'tabulate'],
classifiers = [
'Development Status :: 2 - Pre-Alpha',
'Environment :: Web Environment',
'Intended Audience :: Financial and Insurance Industry',
'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Topic :: Scientific/Engineering :: Mathematics',
'Topic :: Software Development :: Libraries :: Python Modules'
])
if __name__ == "__main__":
setup_package()