This repository has been archived by the owner on Dec 1, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathsetup.py
129 lines (114 loc) · 4.42 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
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from setuptools import setup
from distutils.version import LooseVersion
import sys
description = ('A framework for a rapid reproducible experimental design, '
'analysis and modeling of data in neuroscience and psychology.')
exec(open('psychopy_ext/version.py').read())
# required pip-installable packages
pip_reqs = []
# required non-pip-installable packages
reqs = []
# recommended non-pip-installable packages
recs = [('psychopy', '1.83.4', 'experiments'),
('pandas', '0.17', 'general purposes'),
('seaborn', '0.7', 'plotting'),
('nibabel', None, 'fMRI analyses'),
('h5py', None, 'fMRI analyses'),
('mvpa2', '2.3.1', 'fMRI analyses'),
('sklearn', None, 'models'),
('skimage', None, 'models'),
('caffe', None, 'models'),
('docutils', None, 'experiments'),
('svgwrite', None, 'experiments'),
('matlab_wrapper', None, 'models')
]
def try_import(package, version=None, descr=None):
"""Looks for a requested package
"""
missing = False
if version is None:
version = '0'
try:
imported = __import__(package)
except:
missing = [package, descr]
else:
try:
found_version = getattr(imported, '__version__')
except:
missing = [package, version, 'unknown version']
else:
if LooseVersion(found_version) < LooseVersion(version):
missing = [package, version, found_version]
return missing
# check for required dependencies and exit gracefully if missing
missing_reqs = [try_import(*info) for info in reqs]
if any(missing_reqs):
print()
print('=============')
print('ERROR: Some REQUIRED packages are missing or not up-to-date. '
'Please install them manually as they are often tricky to '
'install via pip.')
print()
for miss in missing_reqs:
if miss != False:
if len(miss) < 3:
print('%s: missing' % miss[0])
else:
print('%s: update to at least version %s (found %s)' % tuple(miss))
print('=============')
sys.exit(1)
fs = ['README.rst', 'CHANGES.txt']
long_description = [open(f).read() for f in fs]
long_description = '\n'.join(long_description)
setup(
name='psychopy_ext',
version=__version__,
author='Jonas Kubilius',
author_email='[email protected]',
packages=['docs', 'psychopy_ext', 'psychopy_ext.demos',
'psychopy_ext.demos.scripts', 'psychopy_ext.tests'],
package_data={str(''): [str('*.png'), str('*.py*'), str('*.bat'), str('*.csv'), str('*.txt')]},
url='https://github.com/qbilius/psychopy_ext/',
license='GNU General Public License v3 or later',
description=description,
long_description=long_description,
install_requires=pip_reqs,
# scripts=['bin/psycho-models.py'],
#test_suite='nose.collector',
#tests_require=['nose'],
classifiers=[
'Development Status :: 4 - Beta',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)',
'Operating System :: OS Independent',
'Programming Language :: Python :: 2.7',
'Topic :: Scientific/Engineering'
],
keywords=('psychology experiments plotting data visualization analysis '
'fMRI simulations deep neural networks models hmax gaborjet hog '
'phog reproducible research open science'),
)
# check for recommendeed dependencies and suggest them at the end if missing
missing_recs = [try_import(*info) for info in recs]
if any(missing_recs):
print()
print('=============')
print("Installation complete. However, in order to actually use "
"psychopy_ext, you need extra dependencies (listed below) that are "
"often tricky to install. You'll have to install them manually. If "
"you are not sure about the best way to go, I recommend using "
"Conda.")
print()
for miss in missing_recs:
if miss != False:
if len(miss) == 1:
print('%s: missing' % miss[0])
elif len(miss) == 2:
print('%s: missing; used for %s' % (miss[0], miss[1]))
else:
print('%s: update to at least version %s (found %s)' % tuple(miss))
print('=============')