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