forked from scikit-learn-contrib/py-earth
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
165 lines (157 loc) · 6.12 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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
from setuptools import setup, Extension, find_packages
import sys
import codecs
import versioneer
# Determine whether to use Cython
if '--cythonize' in sys.argv:
cythonize_switch = True
del sys.argv[sys.argv.index('--cythonize')]
else:
cythonize_switch = False
def get_ext_modules():
import numpy
# Find all includes
local_inc = 'pyearth'
numpy_inc = numpy.get_include()
# Set up the ext_modules for Cython or not, depending
if cythonize_switch:
from Cython.Build import cythonize
ext_modules = cythonize(
[Extension(
"pyearth._util", ["pyearth/_util.pyx"], include_dirs=[numpy_inc]),
Extension(
"pyearth._basis",
["pyearth/_basis.pyx"],
include_dirs=[numpy_inc]),
Extension(
"pyearth._record",
["pyearth/_record.pyx"],
include_dirs=[numpy_inc]),
Extension(
"pyearth._pruning",
["pyearth/_pruning.pyx"],
include_dirs=[local_inc,
numpy_inc]),
Extension(
"pyearth._forward",
["pyearth/_forward.pyx"],
include_dirs=[local_inc,
numpy_inc]),
Extension(
"pyearth._knot_search",
["pyearth/_knot_search.pyx"],
include_dirs=[local_inc,
numpy_inc]),
Extension(
"pyearth._qr",
["pyearth/_qr.pyx"],
include_dirs=[local_inc,
numpy_inc]),
Extension(
"pyearth._types",
["pyearth/_types.pyx"],
include_dirs=[local_inc,
numpy_inc])
])
else:
ext_modules = [Extension(
"pyearth._util", ["pyearth/_util.c"], include_dirs=[numpy_inc]),
Extension(
"pyearth._basis",
["pyearth/_basis.c"],
include_dirs=[numpy_inc]),
Extension(
"pyearth._record",
["pyearth/_record.c"],
include_dirs=[numpy_inc]),
Extension(
"pyearth._pruning",
["pyearth/_pruning.c"],
include_dirs=[local_inc,
numpy_inc]),
Extension(
"pyearth._forward",
["pyearth/_forward.c"],
include_dirs=[local_inc,
numpy_inc]),
Extension(
"pyearth._knot_search",
["pyearth/_knot_search.c"],
include_dirs=[local_inc,
numpy_inc]),
Extension(
"pyearth._qr",
["pyearth/_qr.c"],
include_dirs=[local_inc,
numpy_inc]),
Extension(
"pyearth._types",
["pyearth/_types.c"],
include_dirs=[local_inc,
numpy_inc])
]
return ext_modules
def setup_package():
# Create a dictionary of arguments for setup
setup_args = {
'name': 'sklearn-contrib-py-earth',
'version': versioneer.get_version(),
'author': 'Jason Rudy',
'author_email': '[email protected]',
'packages': find_packages(),
'license': 'LICENSE.txt',
'download_url': 'https://github.com/scikit-learn-contrib/py-earth/archive/0.1.tar.gz',
'description':
'A Python implementation of Jerome Friedman\'s Multivariate Adaptive Regression Splines.',
'long_description': codecs.open('README.md', mode='r', encoding='utf-8').read(),
'classifiers': ['Intended Audience :: Developers',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: BSD License',
'Development Status :: 3 - Alpha',
'Operating System :: MacOS',
'Operating System :: Microsoft :: Windows',
'Operating System :: POSIX',
'Operating System :: Unix',
'Programming Language :: Cython',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Topic :: Scientific/Engineering',
'Topic :: Software Development'],
'install_requires': [
'scipy >= 0.16',
'scikit-learn >= 0.16',
'six'
],
'extras_require': {'docs': ['sphinx_gallery'],
'dev': ['cython'],
'export': ['sympy'],
'all_tests': ['pandas', 'statsmodels', 'patsy', 'sympy']},
'setup_requires': ['numpy'],
'include_package_data': True
}
# Add the build_ext command only if cythonizing
if cythonize_switch:
from Cython.Distutils import build_ext
setup_args['cmdclass'] = versioneer.get_cmdclass({'build_ext': build_ext})
else:
setup_args['cmdclass'] = versioneer.get_cmdclass()
def is_special_command():
special_list = ('--help-commands',
'egg_info',
'--version',
'clean')
return ('--help' in sys.argv[1:] or
sys.argv[1] in special_list)
if len(sys.argv) >= 2 and is_special_command():
setup(**setup_args)
else:
setup_args['ext_modules'] = get_ext_modules()
setup(**setup_args)
if __name__ == "__main__":
setup_package()