Skip to content

Commit

Permalink
Update for sphinx v6.1.2 (#62)
Browse files Browse the repository at this point in the history
* Update for sphinx v6.1.2
* allow missing documentor overrides
  • Loading branch information
mgeplf authored Jan 10, 2023
1 parent 5bb628b commit fec72f9
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 20 deletions.
42 changes: 29 additions & 13 deletions src/utils/autodoc_override.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,37 @@ def add_autodoc_override(app):
# this will override the normal autodoc directive if required. See:
# https://github.com/sphinx-doc/sphinx/blob/master/sphinx/ext/autodoc/__init__.py#L1464
# https://github.com/sphinx-doc/sphinx/blob/15bc5a32bb0b78b432803e55fffa10c801182c75/sphinx/application.py#L996

# These are found by looking for class members named `objtype` in
# sphinx/ext/autodoc/__init__.py
documenters = [
sea.ModuleDocumenter,
sea.ClassDocumenter,
sea.ExceptionDocumenter,
sea.DataDocumenter,
sea.NewTypeDataDocumenter,
sea.FunctionDocumenter,
sea.DecoratorDocumenter,
sea.MethodDocumenter,
sea.AttributeDocumenter,
sea.PropertyDocumenter,
sea.NewTypeAttributeDocumenter,
"ModuleDocumenter",
"FunctionDocumenter",
"DecoratorDocumenter",
"ClassDocumenter",
"ExceptionDocumenter",
"DataDocumenter",
"MethodDocumenter",
"AttributeDocumenter",
"PropertyDocumenter",
# removed in https://github.com/sphinx-doc/sphinx/pull/10700/files
# and released in v6.1.2
"NewTypeDataDocumenter",
"NewTypeAttributeDocumenter",
]
allowed_missing = {
"NewTypeDataDocumenter",
"NewTypeAttributeDocumenter",
}

for documentor_name in documenters:
try:
documentor = getattr(sea, documentor_name)
except AttributeError as e:
if documentor_name in allowed_missing:
continue
raise e

for d in documenters:
app.add_directive(
"auto" + d.objtype, AutodocDirectiveOverride, override=True
"auto" + documentor.objtype, AutodocDirectiveOverride, override=True
)
10 changes: 4 additions & 6 deletions tests/data/regression.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

<meta name="lang:search.tokenizer" content="[\s]+">

<link rel="shortcut icon" href="_static/favicon.ico">
<link rel="shortcut icon" href="">
<meta name="generator" content="mkdocs-REGRESSION-TEST, mkdocs-material-4.4.2">

<meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />
Expand Down Expand Up @@ -872,7 +872,7 @@ <h3>Code tabs<a class="headerlink" href="#code-tabs" title="Permalink to this he
</div>
</div>
<input id="__tab_1_2" name="__tab_1" type="radio"></input><label for="__tab_1_2">Ruby</label><div class="superfences-content docutils container">
<div class="highlight-ruby notranslate"><div class="highlight"><pre><span></span><span class="nb">require</span> <span class="n">sys</span>
<div class="highlight-ruby notranslate"><div class="highlight"><pre><span></span><span class="nb">require</span><span class="w"> </span><span class="n">sys</span>
</pre></div>
</div>
</div>
Expand Down Expand Up @@ -1393,7 +1393,7 @@ <h2 id="__source">Source</h2>


<div class="md-footer-copyright__highlight">
&copy; Blue Brain Project/EPFL 2005-2022. All rights reserved.
&copy; Blue Brain Project/EPFL 2005-2023. All rights reserved.
</div>


Expand Down Expand Up @@ -1429,10 +1429,8 @@ <h2 id="__source">Source</h2>
</div>

<script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script>
<script src="_static/jquery.js"></script>
<script src="_static/underscore.js"></script>
<script src="_static/_sphinx_javascript_frameworks_compat.js"></script>
<script src="_static/doctools.js"></script>
<script src="_static/sphinx_highlight.js"></script>
<script src="_static/javascripts/theme.js"></script>
<script src="_static/javascripts/utils.js"></script>

Expand Down
4 changes: 3 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ deps =
build_docs =
make -C doc clean
make -C doc html SPHINXOPTS=-Wv
allowlist_externals =
make

[tox]
minversion = 3.20
Expand Down Expand Up @@ -31,7 +33,7 @@ commands =
pytest tests
{[base]build_docs}
git --no-pager diff --no-index -- tests/data/regression.html doc/build/html/regression.html
whitelist_externals =
allowlist_externals =
git
make

Expand Down

0 comments on commit fec72f9

Please sign in to comment.