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