forked from kaelzhang/stock-pandas
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
108 lines (90 loc) · 2.81 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
#!/usr/bin/env python3
import os
from setuptools import (
setup,
Extension
)
import numpy as np
# beta version
__version__ = '1.1.2'
BUILDING = os.environ.get('STOCK_PANDAS_BUILDING')
UPLOADING = os.environ.get('STOCK_PANDAS_UPLOADING')
def read(*fname) -> str:
if not UPLOADING:
# DO not read README.md when installing
return '<README.md>'
return open(os.path.join(os.path.dirname(__file__), *fname)).read()
def read_requirements(filename):
with open(filename) as f:
return f.read().splitlines()
ext_kwargs = dict(
# Ignore warning caused by cpython for using deprecated apis
define_macros=[('NPY_NO_DEPRECATED_API', 'NPY_1_7_API_VERSION')],
include_dirs=[np.get_include()]
)
# Distribution ref
# https://cython.readthedocs.io/en/latest/src/userguide/source_files_and_compilation.html#distributing-cython-modules
if BUILDING:
from Cython.Build import cythonize
extensions = cythonize(
Extension(
'stock_pandas.math._lib',
['stock_pandas/math/_lib.pyx'],
language='c++',
**ext_kwargs
),
compiler_directives={
'linetrace': False,
'language_level': 3
}
)
else:
extensions = [
Extension(
'stock_pandas.math._lib',
['stock_pandas/math/_lib.cpp'],
**ext_kwargs
)
]
settings = dict(
name='stock-pandas',
packages=[
'stock_pandas',
'stock_pandas.commands',
'stock_pandas.directive',
'stock_pandas.math',
'stock_pandas.meta'
],
ext_modules=extensions,
zip_safe=False,
version=__version__,
author='Kael Zhang',
author_email='[email protected]',
description='The wrapper of `pandas.DataFrame` with stock statistics and indicators support.', # noqa:E501
install_requires=[
'numpy >= 1.16.5',
'pandas >= 1.0.0'
],
license='MIT',
keywords='pandas pandas-dataframe stock stat indicators macd',
url='https://github.com/kaelzhang/stock-pandas',
long_description=read('docs', 'README.md'),
long_description_content_type='text/markdown',
python_requires='>=3.6',
classifiers=[
'Programming Language :: Python',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: Implementation :: CPython',
'Natural Language :: English',
'Intended Audience :: Developers',
'Intended Audience :: Financial and Insurance Industry',
'Operating System :: OS Independent',
'Development Status :: 4 - Beta',
'Topic :: Utilities',
'License :: OSI Approved :: Apache Software License',
],
)
if __name__ == '__main__':
setup(**settings)