Skip to content

Commit 9338ba3

Browse files
committed
ENH: Support calling Sphinx with Python 3
Update doc/source/conf.py to Python 3 Unbundle numpydoc, add to travis tests STY: PEP8 style cleanup
1 parent fde94f1 commit 9338ba3

File tree

6 files changed

+28
-769
lines changed

6 files changed

+28
-769
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ script:
107107
COVER_ARGS="--with-coverage --cover-package nibabel";
108108
fi
109109
- if [ "$DOC_DOC_TEST" == "1" ]; then
110-
pip install sphinx;
110+
pip install sphinx numpydoc;
111111
cd ../doc;
112112
make html;
113113
make doctest;

doc/source/conf.py

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,45 +11,51 @@
1111
# nipype documentation build configuration file, created by
1212
# sphinx-quickstart on Mon Jul 20 12:30:18 2009.
1313
#
14-
# This file is execfile()d with the current directory set to its containing dir.
14+
# This file is exec()d with the current directory set to its containing dir.
1515
#
1616
# Note that not all possible configuration values are present in this
1717
# autogenerated file.
1818
#
1919
# All configuration values have a default; values that are commented out
2020
# serve to show the default.
2121

22-
import sys, os
22+
import sys
23+
import os
2324

2425
import nibabel
2526

27+
# Check for external Sphinx extensions we depend on
28+
try:
29+
import numpydoc
30+
except ImportError:
31+
raise RuntimeError('Need to install "numpydoc" package for doc build')
32+
2633
# If extensions (or modules to document with autodoc) are in another directory,
2734
# add these directories to sys.path here. If the directory is relative to the
2835
# documentation root, use os.path.abspath to make it absolute, like shown here.
2936
sys.path.append(os.path.abspath('../sphinxext'))
3037

31-
# -- General configuration -----------------------------------------------------
38+
# -- General configuration ----------------------------------------------------
3239

3340
# We load the nibabel release info into a dict by explicit execution
3441
rel = {}
35-
execfile('../../nibabel/info.py', rel)
42+
with open(os.path.join('..', '..', 'nibabel', 'info.py'), 'r') as fobj:
43+
exec(fobj.read(), rel)
3644

3745
# Write long description from info
3846
with open('_long_description.inc', 'wt') as fobj:
3947
fobj.write(rel['LONG_DESCRIPTION'])
4048

41-
# Add any Sphinx extension module names here, as strings. They can be extensions
42-
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
49+
# Add any Sphinx extension module names here, as strings. They can be
50+
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
4351
extensions = ['sphinx.ext.autodoc',
4452
'sphinx.ext.doctest',
4553
#'sphinx.ext.intersphinx',
4654
'sphinx.ext.todo',
4755
'sphinx.ext.mathjax',
4856
'sphinx.ext.inheritance_diagram',
4957
'sphinx.ext.autosummary',
50-
'math_dollar', # has to go before numpydoc
51-
# we have a local copy of the extension, imported from NumPy 1.3
52-
# this also includes the docscrape* extensions
58+
'math_dollar', # has to go before numpydoc
5359
'numpydoc',
5460
'only_directives',
5561
'plot_directive',
@@ -104,7 +110,7 @@
104110
# for source files.
105111
exclude_trees = ['_build']
106112

107-
# The reST default role (used for this markup: `text`) to use for all documents.
113+
# The reST default role (used for this markup: `text`) to use for all documents
108114
#default_role = None
109115

110116
# If true, '()' will be appended to :func: etc. cross-reference text.
@@ -124,7 +130,7 @@
124130
# A list of ignored prefixes for module index sorting.
125131
#modindex_common_prefix = []
126132

127-
# -- Sphinxext configuration ---------------------------------------------------
133+
# -- Sphinxext configuration --------------------------------------------------
128134

129135
# Set attributes for layout of inheritance diagrams
130136
inheritance_graph_attrs = dict(rankdir="LR", size='"6.0, 8.0"', fontsize=14,
@@ -135,7 +141,7 @@
135141
# Flag to show todo items in rendered output
136142
todo_include_todos = True
137143

138-
# -- Options for HTML output ---------------------------------------------------
144+
# -- Options for HTML output --------------------------------------------------
139145

140146
# The theme to use for HTML and HTML Help pages. Major themes that come with
141147
# Sphinx are currently 'default' and 'sphinxdoc'.
@@ -218,7 +224,7 @@
218224

219225
mathjax_path = 'https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML'
220226

221-
# -- Options for LaTeX output --------------------------------------------------
227+
# -- Options for LaTeX output -------------------------------------------------
222228

223229
# The paper size ('letter' or 'a4').
224230
#latex_paper_size = 'letter'
@@ -227,11 +233,11 @@
227233
#latex_font_size = '10pt'
228234

229235
# Grouping the document tree into LaTeX files. List of tuples
230-
# (source start file, target name, title, author, documentclass [howto/manual]).
236+
# (source start file, target name, title, author,
237+
# documentclass [howto/manual]).
231238
latex_documents = [
232-
('index', 'nibabel.tex', u'NiBabel Documentation',
233-
u'NiBabel Authors', 'manual'),
234-
]
239+
('index', 'nibabel.tex', u'NiBabel Documentation', u'NiBabel Authors',
240+
'manual')]
235241

236242
# The name of an image file (relative to this directory) to place at the top of
237243
# the title page.

0 commit comments

Comments
 (0)