|
1 | 1 | #!/usr/bin/env python3 |
2 | 2 | # -*- coding: utf-8 -*- |
3 | 3 | # |
| 4 | + |
4 | 5 | # jupyterannotate documentation build configuration file |
5 | 6 | # |
6 | 7 | # This file is execfile()d with the current directory set to its |
|
23 | 24 | # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom |
24 | 25 | # ones. |
25 | 26 | extensions = [ |
26 | | - 'sphinx.ext.autodoc', |
27 | | - 'sphinx.ext.viewcode', |
28 | | - 'sphinx.ext.intersphinx', |
29 | | - 'sphinx.ext.napoleon', |
30 | | - 'sphinx.ext.todo', |
31 | | - 'nbsphinx', |
32 | | - 'jupyter_sphinx', |
33 | | - 'nbsphinx_link', |
| 27 | + "sphinx.ext.autodoc", |
| 28 | + "sphinx.ext.viewcode", |
| 29 | + "sphinx.ext.intersphinx", |
| 30 | + "sphinx.ext.napoleon", |
| 31 | + "sphinx.ext.todo", |
| 32 | + "nbsphinx", |
| 33 | + "jupyter_sphinx", |
| 34 | + "nbsphinx_link", |
34 | 35 | ] |
35 | 36 |
|
36 | 37 | # Set the nbsphinx JS path to empty to avoid showing twice of the widgets |
|
40 | 41 | # Ensure our extension is available: |
41 | 42 | import sys |
42 | 43 | from os.path import dirname, join as pjoin |
| 44 | + |
43 | 45 | docs = dirname(dirname(__file__)) |
44 | 46 | root = dirname(docs) |
45 | 47 | sys.path.insert(0, root) |
46 | | -sys.path.insert(0, pjoin(docs, 'sphinxext')) |
| 48 | +sys.path.insert(0, pjoin(docs, "sphinxext")) |
47 | 49 |
|
48 | 50 | # Add any paths that contain templates here, relative to this directory. |
49 | | -templates_path = ['_templates'] |
| 51 | +templates_path = ["_templates"] |
50 | 52 |
|
51 | 53 | # The suffix(es) of source filenames. |
52 | 54 | # You can specify multiple suffix as a list of string: |
53 | 55 | # |
54 | 56 | # source_suffix = ['.rst', '.md'] |
55 | | -source_suffix = '.rst' |
| 57 | +source_suffix = ".rst" |
56 | 58 |
|
57 | 59 | # The master toctree document. |
58 | | -master_doc = 'index' |
| 60 | +master_doc = "index" |
59 | 61 |
|
60 | 62 | # General information about the project. |
61 | | -project = 'jupyterannotate' |
62 | | -copyright = '2022, Stuart Quin' |
63 | | -author = 'Stuart Quin' |
| 63 | +project = "jupyterannotate" |
| 64 | +copyright = "2022, Stuart Quin" |
| 65 | +author = "Stuart Quin" |
64 | 66 |
|
65 | 67 | # The version info for the project you're documenting, acts as replacement for |
66 | 68 | # |version| and |release|, also used in various other places throughout the |
|
71 | 73 |
|
72 | 74 | # get version from python package: |
73 | 75 | import os |
| 76 | + |
74 | 77 | here = os.path.dirname(__file__) |
75 | | -repo = os.path.join(here, '..', '..') |
76 | | -_version_py = os.path.join(repo, 'jupyterannotate', '_version.py') |
| 78 | +repo = os.path.join(here, "..", "..") |
| 79 | +_version_py = os.path.join(repo, "jupyterannotate", "_version.py") |
77 | 80 | version_ns = {} |
78 | 81 | with open(_version_py) as f: |
79 | 82 | exec(f.read(), version_ns) |
80 | 83 |
|
81 | 84 | # The short X.Y version. |
82 | | -version = '%i.%i' % version_ns['version_info'][:2] |
| 85 | +version = "%s.%s" % version_ns["version_info"][:2] |
83 | 86 | # The full version, including alpha/beta/rc tags. |
84 | | -release = version_ns['__version__'] |
| 87 | +release = version_ns["__version__"] |
85 | 88 |
|
86 | 89 | # The language for content autogenerated by Sphinx. Refer to documentation |
87 | 90 | # for a list of supported languages. |
|
93 | 96 | # List of patterns, relative to source directory, that match files and |
94 | 97 | # directories to ignore when looking for source files. |
95 | 98 | # This patterns also effect to html_static_path and html_extra_path |
96 | | -exclude_patterns = ['**.ipynb_checkpoints'] |
| 99 | +exclude_patterns = ["**.ipynb_checkpoints"] |
97 | 100 |
|
98 | 101 | # The name of the Pygments (syntax highlighting) style to use. |
99 | | -pygments_style = 'sphinx' |
| 102 | +pygments_style = "sphinx" |
100 | 103 |
|
101 | 104 | # If true, `todo` and `todoList` produce output, else they produce nothing. |
102 | 105 | todo_include_todos = False |
|
114 | 117 | # Add any paths that contain custom static files (such as style sheets) here, |
115 | 118 | # relative to this directory. They are copied after the builtin static files, |
116 | 119 | # so a file named "default.css" will overwrite the builtin "default.css". |
117 | | -html_static_path = ['_static'] |
| 120 | +html_static_path = ["_static"] |
118 | 121 |
|
119 | 122 |
|
120 | 123 | # -- Options for HTMLHelp output ------------------------------------------ |
121 | 124 |
|
122 | 125 | # Output file base name for HTML help builder. |
123 | | -htmlhelp_basename = 'jupyterannotatedoc' |
| 126 | +htmlhelp_basename = "jupyterannotatedoc" |
124 | 127 |
|
125 | 128 |
|
126 | 129 | # -- Options for LaTeX output --------------------------------------------- |
|
129 | 132 | # The paper size ('letterpaper' or 'a4paper'). |
130 | 133 | # |
131 | 134 | # 'papersize': 'letterpaper', |
132 | | - |
133 | 135 | # The font size ('10pt', '11pt' or '12pt'). |
134 | 136 | # |
135 | 137 | # 'pointsize': '10pt', |
136 | | - |
137 | 138 | # Additional stuff for the LaTeX preamble. |
138 | 139 | # |
139 | 140 | # 'preamble': '', |
140 | | - |
141 | 141 | # Latex figure (float) alignment |
142 | 142 | # |
143 | 143 | # 'figure_align': 'htbp', |
|
147 | 147 | # (source start file, target name, title, |
148 | 148 | # author, documentclass [howto, manual, or own class]). |
149 | 149 | latex_documents = [ |
150 | | - (master_doc, 'jupyterannotate.tex', 'jupyterannotate Documentation', |
151 | | - 'Stuart Quin', 'manual'), |
| 150 | + ( |
| 151 | + master_doc, |
| 152 | + "jupyterannotate.tex", |
| 153 | + "jupyterannotate Documentation", |
| 154 | + "Stuart Quin", |
| 155 | + "manual", |
| 156 | + ), |
152 | 157 | ] |
153 | 158 |
|
154 | 159 |
|
|
157 | 162 | # One entry per manual page. List of tuples |
158 | 163 | # (source start file, name, description, authors, manual section). |
159 | 164 | man_pages = [ |
160 | | - (master_doc, |
161 | | - 'jupyterannotate', |
162 | | - 'jupyterannotate Documentation', |
163 | | - [author], 1) |
| 165 | + (master_doc, "jupyterannotate", "jupyterannotate Documentation", [author], 1) |
164 | 166 | ] |
165 | 167 |
|
166 | 168 |
|
|
170 | 172 | # (source start file, target name, title, author, |
171 | 173 | # dir menu entry, description, category) |
172 | 174 | texinfo_documents = [ |
173 | | - (master_doc, |
174 | | - 'jupyterannotate', |
175 | | - 'jupyterannotate Documentation', |
176 | | - author, |
177 | | - 'jupyterannotate', |
178 | | - 'A Custom Jupyter Widget Library', |
179 | | - 'Miscellaneous'), |
| 175 | + ( |
| 176 | + master_doc, |
| 177 | + "jupyterannotate", |
| 178 | + "jupyterannotate Documentation", |
| 179 | + author, |
| 180 | + "jupyterannotate", |
| 181 | + "A Custom Jupyter Widget Library", |
| 182 | + "Miscellaneous", |
| 183 | + ), |
180 | 184 | ] |
181 | 185 |
|
182 | 186 |
|
183 | 187 | # Example configuration for intersphinx: refer to the Python standard library. |
184 | | -intersphinx_mapping = {'https://docs.python.org/': None} |
| 188 | +intersphinx_mapping = {"https://docs.python.org/": None} |
185 | 189 |
|
186 | 190 | # Read The Docs |
187 | 191 | # on_rtd is whether we are on readthedocs.org, this line of code grabbed from |
188 | 192 | # docs.readthedocs.org |
189 | | -on_rtd = os.environ.get('READTHEDOCS', None) == 'True' |
| 193 | +on_rtd = os.environ.get("READTHEDOCS", None) == "True" |
190 | 194 |
|
191 | 195 | if not on_rtd: # only import and set the theme if we're building docs locally |
192 | 196 | import sphinx_rtd_theme |
193 | | - html_theme = 'sphinx_rtd_theme' |
| 197 | + |
| 198 | + html_theme = "sphinx_rtd_theme" |
194 | 199 | html_theme_path = [sphinx_rtd_theme.get_html_theme_path()] |
195 | 200 |
|
196 | 201 | # otherwise, readthedocs.org uses their theme by default, so no need to specify it |
|
199 | 204 | # Uncomment this line if you have know exceptions in your included notebooks |
200 | 205 | # that nbsphinx complains about: |
201 | 206 | # |
202 | | -nbsphinx_allow_errors = True # exception ipstruct.py ipython_genutils |
| 207 | +nbsphinx_allow_errors = True # exception ipstruct.py ipython_genutils |
203 | 208 |
|
204 | 209 | from sphinx.util import logging |
| 210 | + |
205 | 211 | logger = logging.getLogger(__name__) |
206 | 212 |
|
| 213 | + |
207 | 214 | def setup(app): |
208 | 215 | def add_scripts(app): |
209 | | - for fname in ['helper.js', 'embed-bundle.js']: |
210 | | - if not os.path.exists(os.path.join(here, '_static', fname)): |
211 | | - logger.warning('missing javascript file: %s' % fname) |
| 216 | + for fname in ["helper.js", "embed-bundle.js"]: |
| 217 | + if not os.path.exists(os.path.join(here, "_static", fname)): |
| 218 | + logger.warning("missing javascript file: %s" % fname) |
212 | 219 | app.add_js_file(fname) |
213 | | - app.connect('builder-inited', add_scripts) |
| 220 | + |
| 221 | + app.connect("builder-inited", add_scripts) |
0 commit comments