##// END OF EJS Templates
Ignore `.ipynb_checkpoints` when building docs (#13929)...
Matthias Bussonnier -
r28085:a478e662 merge
parent child Browse files
Show More
@@ -1,337 +1,336 b''
1 # -*- coding: utf-8 -*-
1 # -*- coding: utf-8 -*-
2 #
2 #
3 # IPython documentation build configuration file.
3 # IPython documentation build configuration file.
4
4
5 # NOTE: This file has been edited manually from the auto-generated one from
5 # NOTE: This file has been edited manually from the auto-generated one from
6 # sphinx. Do NOT delete and re-generate. If any changes from sphinx are
6 # sphinx. Do NOT delete and re-generate. If any changes from sphinx are
7 # needed, generate a scratch one and merge by hand any new fields needed.
7 # needed, generate a scratch one and merge by hand any new fields needed.
8
8
9 #
9 #
10 # This file is execfile()d with the current directory set to its containing dir.
10 # This file is execfile()d with the current directory set to its containing dir.
11 #
11 #
12 # The contents of this file are pickled, so don't put values in the namespace
12 # The contents of this file are pickled, so don't put values in the namespace
13 # that aren't pickleable (module imports are okay, they're removed automatically).
13 # that aren't pickleable (module imports are okay, they're removed automatically).
14 #
14 #
15 # All configuration values have a default value; values that are commented out
15 # All configuration values have a default value; values that are commented out
16 # serve to show the default value.
16 # serve to show the default value.
17
17
18 import sys, os
18 import sys, os
19 from pathlib import Path
19 from pathlib import Path
20
20
21 # https://read-the-docs.readthedocs.io/en/latest/faq.html
21 # https://read-the-docs.readthedocs.io/en/latest/faq.html
22 ON_RTD = os.environ.get('READTHEDOCS', None) == 'True'
22 ON_RTD = os.environ.get('READTHEDOCS', None) == 'True'
23
23
24 if ON_RTD:
24 if ON_RTD:
25 tags.add('rtd')
25 tags.add('rtd')
26
26
27 # RTD doesn't use the Makefile, so re-run autogen_{things}.py here.
27 # RTD doesn't use the Makefile, so re-run autogen_{things}.py here.
28 for name in ("config", "api", "magics", "shortcuts"):
28 for name in ("config", "api", "magics", "shortcuts"):
29 fname = Path("autogen_{}.py".format(name))
29 fname = Path("autogen_{}.py".format(name))
30 fpath = (Path(__file__).parent).joinpath("..", fname)
30 fpath = (Path(__file__).parent).joinpath("..", fname)
31 with open(fpath, encoding="utf-8") as f:
31 with open(fpath, encoding="utf-8") as f:
32 exec(
32 exec(
33 compile(f.read(), fname, "exec"),
33 compile(f.read(), fname, "exec"),
34 {
34 {
35 "__file__": fpath,
35 "__file__": fpath,
36 "__name__": "__main__",
36 "__name__": "__main__",
37 },
37 },
38 )
38 )
39 else:
39 else:
40 import sphinx_rtd_theme
40 import sphinx_rtd_theme
41 html_theme = "sphinx_rtd_theme"
41 html_theme = "sphinx_rtd_theme"
42 html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
42 html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
43
43
44 # Allow Python scripts to change behaviour during sphinx run
44 # Allow Python scripts to change behaviour during sphinx run
45 os.environ["IN_SPHINX_RUN"] = "True"
45 os.environ["IN_SPHINX_RUN"] = "True"
46
46
47 autodoc_type_aliases = {
47 autodoc_type_aliases = {
48 "Matcher": " IPython.core.completer.Matcher",
48 "Matcher": " IPython.core.completer.Matcher",
49 "MatcherAPIv1": " IPython.core.completer.MatcherAPIv1",
49 "MatcherAPIv1": " IPython.core.completer.MatcherAPIv1",
50 }
50 }
51
51
52 # If your extensions are in another directory, add it here. If the directory
52 # If your extensions are in another directory, add it here. If the directory
53 # is relative to the documentation root, use os.path.abspath to make it
53 # is relative to the documentation root, use os.path.abspath to make it
54 # absolute, like shown here.
54 # absolute, like shown here.
55 sys.path.insert(0, os.path.abspath('../sphinxext'))
55 sys.path.insert(0, os.path.abspath('../sphinxext'))
56
56
57 # We load the ipython release info into a dict by explicit execution
57 # We load the ipython release info into a dict by explicit execution
58 iprelease = {}
58 iprelease = {}
59 exec(
59 exec(
60 compile(
60 compile(
61 open("../../IPython/core/release.py", encoding="utf-8").read(),
61 open("../../IPython/core/release.py", encoding="utf-8").read(),
62 "../../IPython/core/release.py",
62 "../../IPython/core/release.py",
63 "exec",
63 "exec",
64 ),
64 ),
65 iprelease,
65 iprelease,
66 )
66 )
67
67
68 # General configuration
68 # General configuration
69 # ---------------------
69 # ---------------------
70
70
71 # Add any Sphinx extension module names here, as strings. They can be extensions
71 # Add any Sphinx extension module names here, as strings. They can be extensions
72 # coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
72 # coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
73 extensions = [
73 extensions = [
74 'sphinx.ext.autodoc',
74 'sphinx.ext.autodoc',
75 'sphinx.ext.autosummary',
75 'sphinx.ext.autosummary',
76 'sphinx.ext.doctest',
76 'sphinx.ext.doctest',
77 'sphinx.ext.inheritance_diagram',
77 'sphinx.ext.inheritance_diagram',
78 'sphinx.ext.intersphinx',
78 'sphinx.ext.intersphinx',
79 'sphinx.ext.graphviz',
79 'sphinx.ext.graphviz',
80 'IPython.sphinxext.ipython_console_highlighting',
80 'IPython.sphinxext.ipython_console_highlighting',
81 'IPython.sphinxext.ipython_directive',
81 'IPython.sphinxext.ipython_directive',
82 'sphinx.ext.napoleon', # to preprocess docstrings
82 'sphinx.ext.napoleon', # to preprocess docstrings
83 'github', # for easy GitHub links
83 'github', # for easy GitHub links
84 'magics',
84 'magics',
85 'configtraits',
85 'configtraits',
86 ]
86 ]
87
87
88 # Add any paths that contain templates here, relative to this directory.
88 # Add any paths that contain templates here, relative to this directory.
89 templates_path = ['_templates']
89 templates_path = ['_templates']
90
90
91 # The suffix of source filenames.
91 # The suffix of source filenames.
92 source_suffix = '.rst'
92 source_suffix = '.rst'
93
93
94 rst_prolog = ''
94 rst_prolog = ''
95
95
96 def is_stable(extra):
96 def is_stable(extra):
97 for ext in {'dev', 'b', 'rc'}:
97 for ext in {'dev', 'b', 'rc'}:
98 if ext in extra:
98 if ext in extra:
99 return False
99 return False
100 return True
100 return True
101
101
102 if is_stable(iprelease['_version_extra']):
102 if is_stable(iprelease['_version_extra']):
103 tags.add('ipystable')
103 tags.add('ipystable')
104 print('Adding Tag: ipystable')
104 print('Adding Tag: ipystable')
105 else:
105 else:
106 tags.add('ipydev')
106 tags.add('ipydev')
107 print('Adding Tag: ipydev')
107 print('Adding Tag: ipydev')
108 rst_prolog += """
108 rst_prolog += """
109 .. warning::
109 .. warning::
110
110
111 This documentation covers a development version of IPython. The development
111 This documentation covers a development version of IPython. The development
112 version may differ significantly from the latest stable release.
112 version may differ significantly from the latest stable release.
113 """
113 """
114
114
115 rst_prolog += """
115 rst_prolog += """
116 .. important::
116 .. important::
117
117
118 This documentation covers IPython versions 6.0 and higher. Beginning with
118 This documentation covers IPython versions 6.0 and higher. Beginning with
119 version 6.0, IPython stopped supporting compatibility with Python versions
119 version 6.0, IPython stopped supporting compatibility with Python versions
120 lower than 3.3 including all versions of Python 2.7.
120 lower than 3.3 including all versions of Python 2.7.
121
121
122 If you are looking for an IPython version compatible with Python 2.7,
122 If you are looking for an IPython version compatible with Python 2.7,
123 please use the IPython 5.x LTS release and refer to its documentation (LTS
123 please use the IPython 5.x LTS release and refer to its documentation (LTS
124 is the long term support release).
124 is the long term support release).
125
125
126 """
126 """
127
127
128 # The master toctree document.
128 # The master toctree document.
129 master_doc = 'index'
129 master_doc = 'index'
130
130
131 # General substitutions.
131 # General substitutions.
132 project = 'IPython'
132 project = 'IPython'
133 copyright = 'The IPython Development Team'
133 copyright = 'The IPython Development Team'
134
134
135 # ghissue config
135 # ghissue config
136 github_project_url = "https://github.com/ipython/ipython"
136 github_project_url = "https://github.com/ipython/ipython"
137
137
138 # numpydoc config
138 # numpydoc config
139 numpydoc_show_class_members = False # Otherwise Sphinx emits thousands of warnings
139 numpydoc_show_class_members = False # Otherwise Sphinx emits thousands of warnings
140 numpydoc_class_members_toctree = False
140 numpydoc_class_members_toctree = False
141 warning_is_error = True
141 warning_is_error = True
142
142
143 import logging
143 import logging
144
144
145 class ConfigtraitFilter(logging.Filter):
145 class ConfigtraitFilter(logging.Filter):
146 """
146 """
147 This is a filter to remove in sphinx 3+ the error about config traits being duplicated.
147 This is a filter to remove in sphinx 3+ the error about config traits being duplicated.
148
148
149 As we autogenerate configuration traits from, subclasses have lots of
149 As we autogenerate configuration traits from, subclasses have lots of
150 duplication and we want to silence them. Indeed we build on travis with
150 duplication and we want to silence them. Indeed we build on travis with
151 warnings-as-error set to True, so those duplicate items make the build fail.
151 warnings-as-error set to True, so those duplicate items make the build fail.
152 """
152 """
153
153
154 def filter(self, record):
154 def filter(self, record):
155 if record.args and record.args[0] == 'configtrait' and 'duplicate' in record.msg:
155 if record.args and record.args[0] == 'configtrait' and 'duplicate' in record.msg:
156 return False
156 return False
157 return True
157 return True
158
158
159 ct_filter = ConfigtraitFilter()
159 ct_filter = ConfigtraitFilter()
160
160
161 import sphinx.util
161 import sphinx.util
162 logger = sphinx.util.logging.getLogger('sphinx.domains.std').logger
162 logger = sphinx.util.logging.getLogger('sphinx.domains.std').logger
163
163
164 logger.addFilter(ct_filter)
164 logger.addFilter(ct_filter)
165
165
166 # The default replacements for |version| and |release|, also used in various
166 # The default replacements for |version| and |release|, also used in various
167 # other places throughout the built documents.
167 # other places throughout the built documents.
168 #
168 #
169 # The full version, including alpha/beta/rc tags.
169 # The full version, including alpha/beta/rc tags.
170 release = "%s" % iprelease['version']
170 release = "%s" % iprelease['version']
171 # Just the X.Y.Z part, no '-dev'
171 # Just the X.Y.Z part, no '-dev'
172 version = iprelease['version'].split('-', 1)[0]
172 version = iprelease['version'].split('-', 1)[0]
173
173
174
174
175 # There are two options for replacing |today|: either, you set today to some
175 # There are two options for replacing |today|: either, you set today to some
176 # non-false value, then it is used:
176 # non-false value, then it is used:
177 #today = ''
177 #today = ''
178 # Else, today_fmt is used as the format for a strftime call.
178 # Else, today_fmt is used as the format for a strftime call.
179 today_fmt = '%B %d, %Y'
179 today_fmt = '%B %d, %Y'
180
180
181 # List of documents that shouldn't be included in the build.
181 # List of documents that shouldn't be included in the build.
182 #unused_docs = []
182 #unused_docs = []
183
183
184 # Exclude these glob-style patterns when looking for source files. They are
184 # Exclude these glob-style patterns when looking for source files. They are
185 # relative to the source/ directory.
185 # relative to the source/ directory.
186 exclude_patterns = []
186 exclude_patterns = ["**.ipynb_checkpoints"]
187
188
187
189 # If true, '()' will be appended to :func: etc. cross-reference text.
188 # If true, '()' will be appended to :func: etc. cross-reference text.
190 #add_function_parentheses = True
189 #add_function_parentheses = True
191
190
192 # If true, the current module name will be prepended to all description
191 # If true, the current module name will be prepended to all description
193 # unit titles (such as .. function::).
192 # unit titles (such as .. function::).
194 #add_module_names = True
193 #add_module_names = True
195
194
196 # If true, sectionauthor and moduleauthor directives will be shown in the
195 # If true, sectionauthor and moduleauthor directives will be shown in the
197 # output. They are ignored by default.
196 # output. They are ignored by default.
198 #show_authors = False
197 #show_authors = False
199
198
200 # The name of the Pygments (syntax highlighting) style to use.
199 # The name of the Pygments (syntax highlighting) style to use.
201 pygments_style = 'sphinx'
200 pygments_style = 'sphinx'
202
201
203 # Set the default role so we can use `foo` instead of ``foo``
202 # Set the default role so we can use `foo` instead of ``foo``
204 default_role = 'literal'
203 default_role = 'literal'
205
204
206 # Options for HTML output
205 # Options for HTML output
207 # -----------------------
206 # -----------------------
208
207
209 # The style sheet to use for HTML and HTML Help pages. A file of that name
208 # The style sheet to use for HTML and HTML Help pages. A file of that name
210 # must exist either in Sphinx' static/ path, or in one of the custom paths
209 # must exist either in Sphinx' static/ path, or in one of the custom paths
211 # given in html_static_path.
210 # given in html_static_path.
212 # html_style = 'default.css'
211 # html_style = 'default.css'
213
212
214 # The name for this set of Sphinx documents. If None, it defaults to
213 # The name for this set of Sphinx documents. If None, it defaults to
215 # "<project> v<release> documentation".
214 # "<project> v<release> documentation".
216 #html_title = None
215 #html_title = None
217
216
218 # The name of an image file (within the static path) to place at the top of
217 # The name of an image file (within the static path) to place at the top of
219 # the sidebar.
218 # the sidebar.
220 #html_logo = None
219 #html_logo = None
221
220
222 # Add any paths that contain custom static files (such as style sheets) here,
221 # Add any paths that contain custom static files (such as style sheets) here,
223 # relative to this directory. They are copied after the builtin static files,
222 # relative to this directory. They are copied after the builtin static files,
224 # so a file named "default.css" will overwrite the builtin "default.css".
223 # so a file named "default.css" will overwrite the builtin "default.css".
225 html_static_path = ['_static']
224 html_static_path = ['_static']
226
225
227 # Favicon needs the directory name
226 # Favicon needs the directory name
228 html_favicon = '_static/favicon.ico'
227 html_favicon = '_static/favicon.ico'
229 # If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
228 # If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
230 # using the given strftime format.
229 # using the given strftime format.
231 html_last_updated_fmt = '%b %d, %Y'
230 html_last_updated_fmt = '%b %d, %Y'
232
231
233 # If true, SmartyPants will be used to convert quotes and dashes to
232 # If true, SmartyPants will be used to convert quotes and dashes to
234 # typographically correct entities.
233 # typographically correct entities.
235 #html_use_smartypants = True
234 #html_use_smartypants = True
236
235
237 # Custom sidebar templates, maps document names to template names.
236 # Custom sidebar templates, maps document names to template names.
238 #html_sidebars = {}
237 #html_sidebars = {}
239
238
240 # Additional templates that should be rendered to pages, maps page names to
239 # Additional templates that should be rendered to pages, maps page names to
241 # template names.
240 # template names.
242 html_additional_pages = {
241 html_additional_pages = {
243 'interactive/htmlnotebook': 'notebook_redirect.html',
242 'interactive/htmlnotebook': 'notebook_redirect.html',
244 'interactive/notebook': 'notebook_redirect.html',
243 'interactive/notebook': 'notebook_redirect.html',
245 'interactive/nbconvert': 'notebook_redirect.html',
244 'interactive/nbconvert': 'notebook_redirect.html',
246 'interactive/public_server': 'notebook_redirect.html',
245 'interactive/public_server': 'notebook_redirect.html',
247 }
246 }
248
247
249 # If false, no module index is generated.
248 # If false, no module index is generated.
250 #html_use_modindex = True
249 #html_use_modindex = True
251
250
252 # If true, the reST sources are included in the HTML build as _sources/<name>.
251 # If true, the reST sources are included in the HTML build as _sources/<name>.
253 #html_copy_source = True
252 #html_copy_source = True
254
253
255 # If true, an OpenSearch description file will be output, and all pages will
254 # If true, an OpenSearch description file will be output, and all pages will
256 # contain a <link> tag referring to it. The value of this option must be the
255 # contain a <link> tag referring to it. The value of this option must be the
257 # base URL from which the finished HTML is served.
256 # base URL from which the finished HTML is served.
258 #html_use_opensearch = ''
257 #html_use_opensearch = ''
259
258
260 # If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml").
259 # If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml").
261 #html_file_suffix = ''
260 #html_file_suffix = ''
262
261
263 # Output file base name for HTML help builder.
262 # Output file base name for HTML help builder.
264 htmlhelp_basename = 'ipythondoc'
263 htmlhelp_basename = 'ipythondoc'
265
264
266 intersphinx_mapping = {'python': ('https://docs.python.org/3/', None),
265 intersphinx_mapping = {'python': ('https://docs.python.org/3/', None),
267 'rpy2': ('https://rpy2.github.io/doc/latest/html/', None),
266 'rpy2': ('https://rpy2.github.io/doc/latest/html/', None),
268 'jupyterclient': ('https://jupyter-client.readthedocs.io/en/latest/', None),
267 'jupyterclient': ('https://jupyter-client.readthedocs.io/en/latest/', None),
269 'jupyter': ('https://jupyter.readthedocs.io/en/latest/', None),
268 'jupyter': ('https://jupyter.readthedocs.io/en/latest/', None),
270 'jedi': ('https://jedi.readthedocs.io/en/latest/', None),
269 'jedi': ('https://jedi.readthedocs.io/en/latest/', None),
271 'traitlets': ('https://traitlets.readthedocs.io/en/latest/', None),
270 'traitlets': ('https://traitlets.readthedocs.io/en/latest/', None),
272 'ipykernel': ('https://ipykernel.readthedocs.io/en/latest/', None),
271 'ipykernel': ('https://ipykernel.readthedocs.io/en/latest/', None),
273 'prompt_toolkit' : ('https://python-prompt-toolkit.readthedocs.io/en/stable/', None),
272 'prompt_toolkit' : ('https://python-prompt-toolkit.readthedocs.io/en/stable/', None),
274 'ipywidgets': ('https://ipywidgets.readthedocs.io/en/stable/', None),
273 'ipywidgets': ('https://ipywidgets.readthedocs.io/en/stable/', None),
275 'ipyparallel': ('https://ipyparallel.readthedocs.io/en/stable/', None),
274 'ipyparallel': ('https://ipyparallel.readthedocs.io/en/stable/', None),
276 'pip': ('https://pip.pypa.io/en/stable/', None)
275 'pip': ('https://pip.pypa.io/en/stable/', None)
277 }
276 }
278
277
279 # Options for LaTeX output
278 # Options for LaTeX output
280 # ------------------------
279 # ------------------------
281
280
282 # The font size ('10pt', '11pt' or '12pt').
281 # The font size ('10pt', '11pt' or '12pt').
283 latex_font_size = '11pt'
282 latex_font_size = '11pt'
284
283
285 # Grouping the document tree into LaTeX files. List of tuples
284 # Grouping the document tree into LaTeX files. List of tuples
286 # (source start file, target name, title, author, document class [howto/manual]).
285 # (source start file, target name, title, author, document class [howto/manual]).
287
286
288 latex_documents = [
287 latex_documents = [
289 ('index', 'ipython.tex', 'IPython Documentation',
288 ('index', 'ipython.tex', 'IPython Documentation',
290 u"""The IPython Development Team""", 'manual', True),
289 u"""The IPython Development Team""", 'manual', True),
291 ('parallel/winhpc_index', 'winhpc_whitepaper.tex',
290 ('parallel/winhpc_index', 'winhpc_whitepaper.tex',
292 'Using IPython on Windows HPC Server 2008',
291 'Using IPython on Windows HPC Server 2008',
293 u"Brian E. Granger", 'manual', True)
292 u"Brian E. Granger", 'manual', True)
294 ]
293 ]
295
294
296 # The name of an image file (relative to this directory) to place at the top of
295 # The name of an image file (relative to this directory) to place at the top of
297 # the title page.
296 # the title page.
298 #latex_logo = None
297 #latex_logo = None
299
298
300 # For "manual" documents, if this is true, then toplevel headings are parts,
299 # For "manual" documents, if this is true, then toplevel headings are parts,
301 # not chapters.
300 # not chapters.
302 #latex_use_parts = False
301 #latex_use_parts = False
303
302
304 # Additional stuff for the LaTeX preamble.
303 # Additional stuff for the LaTeX preamble.
305 #latex_preamble = ''
304 #latex_preamble = ''
306
305
307 # Documents to append as an appendix to all manuals.
306 # Documents to append as an appendix to all manuals.
308 #latex_appendices = []
307 #latex_appendices = []
309
308
310 # If false, no module index is generated.
309 # If false, no module index is generated.
311 latex_use_modindex = True
310 latex_use_modindex = True
312
311
313
312
314 # Options for texinfo output
313 # Options for texinfo output
315 # --------------------------
314 # --------------------------
316
315
317 texinfo_documents = [
316 texinfo_documents = [
318 (master_doc, 'ipython', 'IPython Documentation',
317 (master_doc, 'ipython', 'IPython Documentation',
319 'The IPython Development Team',
318 'The IPython Development Team',
320 'IPython',
319 'IPython',
321 'IPython Documentation',
320 'IPython Documentation',
322 'Programming',
321 'Programming',
323 1),
322 1),
324 ]
323 ]
325
324
326 modindex_common_prefix = ['IPython.']
325 modindex_common_prefix = ['IPython.']
327
326
328
327
329 def setup(app):
328 def setup(app):
330 app.add_css_file("theme_overrides.css")
329 app.add_css_file("theme_overrides.css")
331
330
332
331
333 # Cleanup
332 # Cleanup
334 # -------
333 # -------
335 # delete release info to avoid pickling errors from sphinx
334 # delete release info to avoid pickling errors from sphinx
336
335
337 del iprelease
336 del iprelease
General Comments 0
You need to be logged in to leave comments. Login now