-
Notifications
You must be signed in to change notification settings - Fork 17
/
setup.py
230 lines (204 loc) · 7.57 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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
"""MSMBuilder: Statistical models for Biomolecular Dynamics
"""
from __future__ import print_function, absolute_import
DOCLINES = __doc__.split("\n")
import sys
import traceback
import numpy as np
from os.path import join as pjoin
from setuptools import setup, Extension, find_packages
try:
sys.dont_write_bytecode = True
sys.path.insert(0, '.')
from basesetup import write_version_py, CompilerDetection, \
check_dependencies
finally:
sys.dont_write_bytecode = False
try:
import mdtraj
mdtraj_capi = mdtraj.capi()
except (ImportError, AttributeError):
print('=' * 80)
print('MDTraj version 1.1.X or later is required')
print('=' * 80)
traceback.print_exc()
sys.exit(1)
if '--debug' in sys.argv:
sys.argv.remove('--debug')
DEBUG = True
else:
DEBUG = False
if '--disable-openmp' in sys.argv:
sys.argv.remove('--disable-openmp')
DISABLE_OPENMP = True
else:
DISABLE_OPENMP = False
try:
import Cython
from Cython.Distutils import build_ext
if Cython.__version__ < '0.18':
raise ImportError()
except ImportError:
print(
'Cython version 0.18 or later is required. Try "conda install cython"')
sys.exit(1)
# #########################
VERSION = '3.9.0'
ISRELEASED = False
__version__ = VERSION
# #########################
CLASSIFIERS = """\
Intended Audience :: Science/Research
Intended Audience :: Developers
License :: OSI Approved :: GNU Lesser General Public License v2 or later (LGPLv2+)
Programming Language :: C++
Programming Language :: Python
Development Status :: 5 - Production/Stable
Topic :: Software Development
Topic :: Scientific/Engineering
Operating System :: POSIX
Operating System :: Unix
Operating System :: MacOS
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
"""
if any(cmd in sys.argv for cmd in ('install', 'build', 'develop')):
check_dependencies((
('numpy',),
('scipy',),
('pandas',),
('six',),
('mdtraj',),
('sklearn', 'scikit-learn'),
('numpydoc',),
('tables', 'pytables'),
))
# Where to find extensions
MSMDIR = 'msmbuilder/msm/'
HMMDIR = 'msmbuilder/hmm/'
CLUSTERDIR = 'msmbuilder/cluster/'
compiler = CompilerDetection(DISABLE_OPENMP)
with open('msmbuilder/src/config.pxi', 'w') as f:
f.write('''
DEF DEBUG = {debug}
DEF OPENMP = {openmp}
'''.format(openmp=compiler.openmp_enabled, debug=DEBUG))
extensions = []
extensions.append(
Extension('msmbuilder.example_datasets._muller',
sources=[pjoin('msmbuilder', 'example_datasets', '_muller.pyx')],
include_dirs=[np.get_include()]))
extensions.append(
Extension('msmbuilder.msm._markovstatemodel',
sources=[pjoin(MSMDIR, '_markovstatemodel.pyx'),
pjoin(MSMDIR, 'src/transmat_mle_prinz.c')],
include_dirs=[pjoin(MSMDIR, 'src'), np.get_include()]))
extensions.append(
Extension('msmbuilder.tests.test_cyblas',
sources=['msmbuilder/tests/test_cyblas.pyx'],
include_dirs=['msmbuilder/src', np.get_include()]))
extensions.append(
Extension('msmbuilder.msm._ratematrix',
sources=[pjoin(MSMDIR, '_ratematrix.pyx')],
language='c++',
extra_compile_args=compiler.compiler_args_openmp,
libraries=compiler.compiler_libraries_openmp,
include_dirs=['msmbuilder/src', np.get_include()]))
extensions.append(
Extension('msmbuilder.decomposition._speigh',
sources=[pjoin('msmbuilder', 'decomposition', '_speigh.pyx')],
language='c++',
extra_compile_args=compiler.compiler_args_openmp,
libraries=compiler.compiler_libraries_openmp,
include_dirs=['msmbuilder/src', np.get_include()]))
extensions.append(
Extension('msmbuilder.msm._metzner_mcmc_fast',
sources=[pjoin(MSMDIR, '_metzner_mcmc_fast.pyx'),
pjoin(MSMDIR, 'src/metzner_mcmc.c')],
libraries=compiler.compiler_libraries_openmp,
extra_compile_args=compiler.compiler_args_openmp,
include_dirs=[pjoin(MSMDIR, 'src'), np.get_include()]))
extensions.append(
Extension('msmbuilder.libdistance',
language='c++',
sources=['msmbuilder/libdistance/libdistance.pyx'],
# msvc needs to be told "libtheobald", gcc wants just "theobald"
libraries=['%stheobald' % ('lib' if compiler.msvc else '')],
include_dirs=["msmbuilder/libdistance/src",
mdtraj_capi['include_dir'], np.get_include()],
library_dirs=[mdtraj_capi['lib_dir']],
))
extensions.append(
Extension('msmbuilder.cluster._kmedoids',
language='c++',
sources=[pjoin(CLUSTERDIR, '_kmedoids.pyx'),
pjoin(CLUSTERDIR, 'src', 'kmedoids.cc')],
include_dirs=[np.get_include()]))
# To get debug symbols on Windows, use
# extra_link_args=['/DEBUG']
# extra_compile_args=['/Zi']
extensions.append(
Extension('msmbuilder.hmm.gaussian',
language='c++',
sources=[pjoin(HMMDIR, 'gaussian.pyx'),
pjoin(HMMDIR, 'src/GaussianHMMFitter.cpp')],
libraries=compiler.compiler_libraries_openmp,
extra_compile_args=compiler.compiler_args_sse3
+ compiler.compiler_args_openmp,
include_dirs=[np.get_include(),
HMMDIR,
pjoin(HMMDIR, 'src/include/'),
pjoin(HMMDIR, 'src/')]))
extensions.append(
Extension('msmbuilder.hmm.vonmises',
language='c++',
sources=[pjoin(HMMDIR, 'vonmises.pyx'),
pjoin(HMMDIR, 'src/VonMisesHMMFitter.cpp'),
pjoin(HMMDIR, 'cephes/i0.c'),
pjoin(HMMDIR, 'cephes/chbevl.c')],
libraries=compiler.compiler_libraries_openmp,
extra_compile_args=compiler.compiler_args_sse3
+ compiler.compiler_args_openmp,
include_dirs=[np.get_include(),
HMMDIR,
pjoin(HMMDIR, 'src/include/'),
pjoin(HMMDIR, 'src/'),
pjoin(HMMDIR, 'cephes/')]))
write_version_py(VERSION, ISRELEASED, filename='msmbuilder/version.py')
setup(name='msmbuilder2022',
author='Robert McGibbon',
author_email='[email protected]',
description=DOCLINES[0],
long_description="\n".join(DOCLINES[2:]),
version=__version__,
url='https://github.com/msmbuilder/msmbuilder',
platforms=['Linux', 'Mac OS-X', 'Unix'],
classifiers=CLASSIFIERS.splitlines(),
packages=find_packages(),
package_data={
'msmbuilder.tests': ['workflows/*'],
'msmbuilder': ['project_templates/*.*',
'project_templates/*/*',
'io_templates/*',
],
},
install_requires=[
'numpy',
'mdtraj',
'scikit-learn',
'pandas',
'fastcluster',
'jinja2',
'pyyaml',
'tables',
'numpydoc',
'six',
'scipy',
'pyhmc @ git+https://github.com/bojunliu0818/pyhmc.git@bojunliu0818-dev',
],
entry_points={'console_scripts':
['msmb = msmbuilder.scripts.msmb:main']},
zip_safe=False,
ext_modules=extensions,
cmdclass={'build_ext': build_ext})