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