forked from DanielBok/muarch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
117 lines (93 loc) · 3.21 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
import os
from setuptools import Extension, find_packages, setup
import versioneer
try:
from Cython.Build import cythonize
from Cython.Compiler import Options
from Cython.Distutils.build_ext import new_build_ext as build_ext
USE_CYTHON = True
except ImportError:
from distutils.command.build_ext import build_ext
USE_CYTHON = False
def cythonize(x, *args, **kwargs):
return x
class Options:
pass
DEV_BUILD = os.environ.get('DEV_BUILD', '0').lower() in ('true', '1')
PACKAGE_NAME = 'muarch'
cmdclass = versioneer.get_cmdclass()
cmdclass.update({
'build_ext': build_ext
})
with open('README.md') as f:
long_description = f.read()
def build_ext_modules():
macros = [('NPY_NO_DEPRECATED_API', '1'),
('NPY_1_7_API_VERSION', '1')]
modules = [
{
'name': 'muarch.volatility._vol_simulations',
'sources': ['muarch/volatility/_vol_simulations.pyx'],
},
{
'name': 'muarch.mean._mean_simulations',
'sources': ['muarch/mean/_mean_simulations.pyx'],
}
]
extensions = []
for m in modules:
# if not built with Cython, use the c or cpp files
language = m.get('language', 'c')
ext = '.pyx' if USE_CYTHON else f'.{language}'
for i, source in enumerate(m['sources']):
_file, _ext = os.path.splitext(source)
m['sources'][i] = _file + ext
extensions.append(Extension(**m, language=language, define_macros=macros))
# compiler options
Options.annotate = DEV_BUILD
# compiler directives
directives = {'language_level': '3', 'profile': DEV_BUILD, 'linetrace': DEV_BUILD}
return cythonize(extensions, compiler_directives=directives)
install_requires = [
'arch >=4.7',
'copulae >=0.4.0',
'numpy >=1.15',
'scipy >=1.1',
'setuptools >=40.8',
'pandas >=0.23'
]
setup(
name=PACKAGE_NAME,
license='MIT',
version=versioneer.get_version().split('+')[0],
description='Multiple Univariate ARCH modeling toolbox built on top of the ARCH package',
author='Daniel Bok',
author_email='daniel.bok@outlook.com',
packages=find_packages(include=['muarch', 'muarch.*']),
ext_modules=build_ext_modules(),
url='https://github.com/DanielBok/muarch',
cmdclass=cmdclass,
long_description=long_description,
long_description_content_type='text/markdown',
classifiers=[
'Development Status :: 3 - Alpha',
'Intended Audience :: Education',
'Intended Audience :: End Users/Desktop',
'Intended Audience :: Financial and Insurance Industry',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent',
'Programming Language :: Cython',
'Programming Language :: Python',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Topic :: Education',
'Topic :: Scientific/Engineering',
],
install_requires=install_requires,
extras_require={"plots": ["matplotlib"]},
python_requires='>=3.7',
include_package_data=True,
zip_safe=False
)