Show More
@@ -22,10 +22,10 from pathlib import Path | |||
|
22 | 22 | config = toml.load("./sphinx.toml") |
|
23 | 23 | |
|
24 | 24 | # https://read-the-docs.readthedocs.io/en/latest/faq.html |
|
25 |
ON_RTD = os.environ.get( |
|
|
25 | ON_RTD = os.environ.get("READTHEDOCS", None) == "True" | |
|
26 | 26 | |
|
27 | 27 | if ON_RTD: |
|
28 |
tags.add( |
|
|
28 | tags.add("rtd") | |
|
29 | 29 | |
|
30 | 30 | # RTD doesn't use the Makefile, so re-run autogen_{things}.py here. |
|
31 | 31 | for name in ("config", "api", "magics", "shortcuts"): |
@@ -52,7 +52,7 autodoc_type_aliases = { | |||
|
52 | 52 | # If your extensions are in another directory, add it here. If the directory |
|
53 | 53 | # is relative to the documentation root, use os.path.abspath to make it |
|
54 | 54 | # absolute, like shown here. |
|
55 |
sys.path.insert(0, os.path.abspath( |
|
|
55 | sys.path.insert(0, os.path.abspath("../sphinxext")) | |
|
56 | 56 | |
|
57 | 57 | # We load the ipython release info into a dict by explicit execution |
|
58 | 58 | iprelease = {} |
@@ -94,10 +94,7 modindex_common_prefix = config["sphinx"]["modindex_common_prefix"] | |||
|
94 | 94 | intersphinx_mapping = config["intersphinx_mapping"] |
|
95 | 95 | for k, v in intersphinx_mapping.items(): |
|
96 | 96 | intersphinx_mapping[k] = tuple( |
|
97 | [ | |
|
98 | intersphinx_mapping[k]['url'], | |
|
99 | intersphinx_mapping[k]['fallback'] | |
|
100 | ] | |
|
97 | [intersphinx_mapping[k]["url"], intersphinx_mapping[k]["fallback"]] | |
|
101 | 98 | ) |
|
102 | 99 | |
|
103 | 100 | # numpydoc config |
@@ -164,30 +161,32 texinfo_documents = [ | |||
|
164 | 161 | # other places throughout the built documents. |
|
165 | 162 | # |
|
166 | 163 | # The full version, including alpha/beta/rc tags. |
|
167 |
release = "%s" % iprelease[ |
|
|
164 | release = "%s" % iprelease["version"] | |
|
168 | 165 | # Just the X.Y.Z part, no '-dev' |
|
169 |
version = iprelease[ |
|
|
166 | version = iprelease["version"].split("-", 1)[0] | |
|
170 | 167 | |
|
171 | 168 | # There are two options for replacing |today|: either, you set today to some |
|
172 | 169 | # non-false value, then it is used: |
|
173 | 170 | #today = '' |
|
174 | 171 | # Else, today_fmt is used as the format for a strftime call. |
|
175 |
today_fmt = |
|
|
172 | today_fmt = "%B %d, %Y" | |
|
176 | 173 | |
|
177 | 174 | rst_prolog = "" |
|
178 | 175 | |
|
176 | ||
|
179 | 177 | def is_stable(extra): |
|
180 |
for ext in { |
|
|
178 | for ext in {"dev", "b", "rc"}: | |
|
181 | 179 | if ext in extra: |
|
182 | 180 | return False |
|
183 | 181 | return True |
|
184 | 182 | |
|
185 | if is_stable(iprelease['_version_extra']): | |
|
186 | tags.add('ipystable') | |
|
187 | print('Adding Tag: ipystable') | |
|
183 | ||
|
184 | if is_stable(iprelease["_version_extra"]): | |
|
185 | tags.add("ipystable") | |
|
186 | print("Adding Tag: ipystable") | |
|
188 | 187 | else: |
|
189 |
tags.add( |
|
|
190 |
print( |
|
|
188 | tags.add("ipydev") | |
|
189 | print("Adding Tag: ipydev") | |
|
191 | 190 | rst_prolog += """ |
|
192 | 191 | .. warning:: |
|
193 | 192 | |
@@ -210,6 +209,7 rst_prolog += """ | |||
|
210 | 209 | |
|
211 | 210 | import logging |
|
212 | 211 | |
|
212 | ||
|
213 | 213 | class ConfigtraitFilter(logging.Filter): |
|
214 | 214 | """ |
|
215 | 215 | This is a filter to remove in sphinx 3+ the error about config traits being duplicated. |
@@ -220,14 +220,20 class ConfigtraitFilter(logging.Filter): | |||
|
220 | 220 | """ |
|
221 | 221 | |
|
222 | 222 | def filter(self, record): |
|
223 | if record.args and record.args[0] == 'configtrait' and 'duplicate' in record.msg: | |
|
223 | if ( | |
|
224 | record.args | |
|
225 | and record.args[0] == "configtrait" | |
|
226 | and "duplicate" in record.msg | |
|
227 | ): | |
|
224 | 228 | return False |
|
225 | 229 | return True |
|
226 | 230 | |
|
231 | ||
|
227 | 232 | ct_filter = ConfigtraitFilter() |
|
228 | 233 | |
|
229 | 234 | import sphinx.util |
|
230 | logger = sphinx.util.logging.getLogger('sphinx.domains.std').logger | |
|
235 | ||
|
236 | logger = sphinx.util.logging.getLogger("sphinx.domains.std").logger | |
|
231 | 237 | logger.addFilter(ct_filter) |
|
232 | 238 | |
|
233 | 239 |
General Comments 0
You need to be logged in to leave comments.
Login now