Skip to content

Commit 3500213

Browse files
committed
fix: installation options and test on py36
1 parent f3ba8d2 commit 3500213

File tree

7 files changed

+65
-56
lines changed

7 files changed

+65
-56
lines changed

nipype/external/due.py

+1-5
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,7 @@ def _donothing_func(*args, **kwargs):
5454
if 'due' in locals() and not hasattr(due, 'cite'):
5555
raise RuntimeError(
5656
"Imported due lacks .cite. DueCredit is now disabled")
57-
except Exception as e:
58-
if type(e).__name__ != 'ImportError':
59-
import logging
60-
logging.getLogger("duecredit").error(
61-
"Failed to import duecredit due to %s" % str(e))
57+
except ImportError:
6258
# Initiate due stub
6359
due = InactiveDueCreditCollector()
6460
BibTeX = Doi = Url = _donothing_func

nipype/info.py

+9-11
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ def get_nipype_gitversion():
5555
'Programming Language :: Python :: 2.7',
5656
'Programming Language :: Python :: 3.4',
5757
'Programming Language :: Python :: 3.5',
58+
'Programming Language :: Python :: 3.6',
5859
'Topic :: Scientific/Engineering']
5960

6061
description = 'Neuroimaging in Python: Pipelines and Interfaces'
@@ -94,16 +95,16 @@ def get_nipype_gitversion():
9495
"""
9596

9697
# versions
97-
NIBABEL_MIN_VERSION = '2.0.1'
98+
NIBABEL_MIN_VERSION = '2.1.0'
9899
NETWORKX_MIN_VERSION = '1.7'
99100
NUMPY_MIN_VERSION = '1.6.2'
100101
SCIPY_MIN_VERSION = '0.11'
101102
TRAITS_MIN_VERSION = '4.6'
102103
DATEUTIL_MIN_VERSION = '1.5'
103104
PYTEST_MIN_VERSION = '3.0'
104-
FUTURE_MIN_VERSION = '0.15.2'
105+
FUTURE_MIN_VERSION = '0.16.0'
105106
SIMPLEJSON_MIN_VERSION = '3.8.0'
106-
PROV_MIN_VERSION = '1.4.0'
107+
PROV_MIN_VERSION = '1.5.0'
107108
CLICK_MIN_VERSION = '6.6.0'
108109

109110
NAME = 'nipype'
@@ -138,23 +139,20 @@ def get_nipype_gitversion():
138139
'click>=%s' % CLICK_MIN_VERSION,
139140
'funcsigs',
140141
'configparser',
141-
'pytest>=%s' % PYTEST_MIN_VERSION
142+
'pytest>=%s' % PYTEST_MIN_VERSION,
143+
'mock',
144+
'pydotplus'
142145
]
143146

144147
TESTS_REQUIRES = [
145-
'pytest>=%s' % PYTEST_MIN_VERSION,
146148
'pytest-cov',
147-
'mock',
148-
'codecov',
149-
'dipy',
150-
'nipy',
151-
'matplotlib'
149+
'codecov'
152150
]
153151

154152
EXTRA_REQUIRES = {
155153
'doc': ['Sphinx>=1.4', 'matplotlib', 'pydotplus'],
156154
'tests': TESTS_REQUIRES,
157-
'fmri': ['nitime', 'nilearn', 'dipy', 'nipy', 'matplotlib'],
155+
'nipy': ['nitime', 'nilearn', 'dipy', 'nipy', 'matplotlib'],
158156
'profiler': ['psutil'],
159157
'duecredit': ['duecredit'],
160158
'xvfbwrapper': ['xvfbwrapper'],

nipype/pipeline/engine/tests/test_engine.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -677,7 +677,8 @@ def test_write_graph_runs(tmpdir):
677677
mod2 = pe.Node(interface=EngineTestInterface(), name='mod2')
678678
pipe.connect([(mod1, mod2, [('output1', 'input1')])])
679679
try:
680-
pipe.write_graph(graph2use=graph, simple_form=simple)
680+
pipe.write_graph(graph2use=graph, simple_form=simple,
681+
format='dot')
681682
except Exception:
682683
assert False, \
683684
'Failed to plot {} {} graph'.format(
@@ -708,7 +709,8 @@ def test_deep_nested_write_graph_runs(tmpdir):
708709
mod1 = pe.Node(interface=EngineTestInterface(), name='mod1')
709710
parent.add_nodes([mod1])
710711
try:
711-
pipe.write_graph(graph2use=graph, simple_form=simple)
712+
pipe.write_graph(graph2use=graph, simple_form=simple,
713+
format='dot')
712714
except Exception as e:
713715
assert False, \
714716
'Failed to plot {} {} deep graph: {!s}'.format(

nipype/pipeline/engine/utils.py

+19-18
Original file line numberDiff line numberDiff line change
@@ -1019,20 +1019,22 @@ def export_graph(graph_in, base_dir=None, show=False, use_execgraph=False,
10191019
use_ext=False,
10201020
newpath=base_dir)
10211021
_write_detailed_dot(graph, outfname)
1022-
cmd = 'dot -T%s -O %s' % (format, outfname)
1023-
res = CommandLine(cmd, terminal_output='allatonce').run()
1024-
if res.runtime.returncode:
1025-
logger.warn('dot2png: %s', res.runtime.stderr)
1022+
if format != 'dot':
1023+
cmd = 'dot -T%s -O %s' % (format, outfname)
1024+
res = CommandLine(cmd, terminal_output='allatonce').run()
1025+
if res.runtime.returncode:
1026+
logger.warn('dot2png: %s', res.runtime.stderr)
10261027
pklgraph = _create_dot_graph(graph, show_connectinfo, simple_form)
10271028
simplefname = fname_presuffix(dotfilename,
10281029
suffix='.dot',
10291030
use_ext=False,
10301031
newpath=base_dir)
10311032
nx.drawing.nx_pydot.write_dot(pklgraph, simplefname)
1032-
cmd = 'dot -T%s -O %s' % (format, simplefname)
1033-
res = CommandLine(cmd, terminal_output='allatonce').run()
1034-
if res.runtime.returncode:
1035-
logger.warn('dot2png: %s', res.runtime.stderr)
1033+
if format != 'dot':
1034+
cmd = 'dot -T%s -O %s' % (format, simplefname)
1035+
res = CommandLine(cmd, terminal_output='allatonce').run()
1036+
if res.runtime.returncode:
1037+
logger.warn('dot2png: %s', res.runtime.stderr)
10361038
if show:
10371039
pos = nx.graphviz_layout(pklgraph, prog='dot')
10381040
nx.draw(pklgraph, pos)
@@ -1045,18 +1047,17 @@ def export_graph(graph_in, base_dir=None, show=False, use_execgraph=False,
10451047
return simplefname if simple_form else outfname
10461048

10471049

1048-
def format_dot(dotfilename, format=None):
1050+
def format_dot(dotfilename, format='png'):
10491051
"""Dump a directed graph (Linux only; install via `brew` on OSX)"""
1050-
cmd = 'dot -T%s -O \'%s\'' % (format, dotfilename)
1051-
try:
1052-
CommandLine(cmd).run()
1053-
except IOError as ioe:
1054-
if "could not be found" in str(ioe):
1055-
raise IOError("Cannot draw directed graph; executable 'dot' is unavailable")
1056-
else:
1057-
raise ioe
1058-
10591052
if format != 'dot':
1053+
cmd = 'dot -T%s -O \'%s\'' % (format, dotfilename)
1054+
try:
1055+
CommandLine(cmd).run()
1056+
except IOError as ioe:
1057+
if "could not be found" in str(ioe):
1058+
raise IOError("Cannot draw directed graph; executable 'dot' is unavailable")
1059+
else:
1060+
raise ioe
10601061
dotfilename += '.%s' % format
10611062
return dotfilename
10621063

nipype/sphinxext/plot_workflow.py

+20-9
Original file line numberDiff line numberDiff line change
@@ -113,22 +113,30 @@
113113
from errno import EEXIST
114114
import traceback
115115

116-
from docutils.parsers.rst import directives
117-
from docutils.parsers.rst.directives.images import Image
118-
116+
missing_imports = []
117+
try:
118+
from docutils.parsers.rst import directives
119+
from docutils.parsers.rst.directives.images import Image
120+
align = Image.align
121+
except ImportError as e:
122+
missing_imports = [str(e)]
119123

120124
try:
121125
# Sphinx depends on either Jinja or Jinja2
122126
import jinja2
123127
def format_template(template, **kw):
124128
return jinja2.Template(template).render(**kw)
125-
except ImportError:
126-
import jinja
127-
def format_template(template, **kw):
128-
return jinja.from_string(template, **kw)
129+
except ImportError as e:
130+
missing_imports.append(str(e))
131+
try:
132+
import jinja
133+
def format_template(template, **kw):
134+
return jinja.from_string(template, **kw)
135+
missing_imports.pop()
136+
except ImportError as e:
137+
missing_imports.append(str(e))
129138

130139
from builtins import str, bytes
131-
align = Image.align
132140

133141
PY2 = sys.version_info[0] == 2
134142
PY3 = sys.version_info[0] == 3
@@ -152,7 +160,10 @@ def _mkdirp(folder):
152160

153161
def wf_directive(name, arguments, options, content, lineno,
154162
content_offset, block_text, state, state_machine):
155-
return run(arguments, content, options, state_machine, state, lineno)
163+
if len(missing_imports) == 0:
164+
return run(arguments, content, options, state_machine, state, lineno)
165+
else:
166+
raise ImportError('\n'.join(missing_imports))
156167
wf_directive.__doc__ = __doc__
157168

158169
def _option_boolean(arg):

requirements.txt

+5-5
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ scipy>=0.11
33
networkx>=1.7
44
traits>=4.6
55
python-dateutil>=1.5
6-
nibabel>=2.0.1
7-
future>=0.15.2
6+
nibabel>=2.1.0
7+
future>=0.16.0
88
simplejson>=3.8.0
9-
prov>=1.4.0
9+
prov>=1.5.0
1010
click>=6.6.0
11-
psutil
1211
funcsigs
1312
configparser
1413
pytest>=3.0
15-
pytest-cov
14+
mock
15+
pytdotplus

rtd_requirements.txt

+7-6
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@ scipy>=0.11
33
networkx>=1.7
44
traits>=4.6
55
python-dateutil>=1.5
6-
nibabel>=2.0.1
7-
pytest>=3.0
8-
pytest-cov
9-
future>=0.15.2
6+
nibabel>=2.1.0
7+
future>=0.16.0
108
simplejson>=3.8.0
11-
prov>=1.4.0
12-
psutil
9+
prov>=1.5.0
1310
funcsigs
1411
configparser
12+
pytest>=3.0
13+
mock
14+
pytdotplus
15+
psutil
1516
matplotlib

0 commit comments

Comments
 (0)