Skip to content

Commit

Permalink
Let Sphinx handle adding domain directives to the toctree (#374)
Browse files Browse the repository at this point in the history
* Remove ability to add domains to the toctree

* Add towncrier news fragment
  • Loading branch information
BrandonWiebe authored Mar 28, 2023
1 parent 007d995 commit 6b16e02
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 171 deletions.
5 changes: 0 additions & 5 deletions autoapi/extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
from .directives import AutoapiSummary, NestedParse
from .inheritance_diagrams import AutoapiInheritanceDiagram
from .settings import API_ROOT
from .toctree import add_domain_to_toctree

LOGGER = sphinx.util.logging.getLogger(__name__)

Expand Down Expand Up @@ -183,9 +182,6 @@ def doctree_read(app, doctree):
Inject AutoAPI into the TOC Tree dynamically.
"""

if app.config.autoapi_add_objects_to_toctree:
add_domain_to_toctree(app, doctree, app.env.docname)

if app.env.docname == "index":
all_docs = set()
insert = True
Expand Down Expand Up @@ -296,7 +292,6 @@ def setup(app):
app.add_config_value("autoapi_python_class_content", "class", "html")
app.add_config_value("autoapi_generate_api_docs", True, "html")
app.add_config_value("autoapi_prepare_jinja_env", None, "html")
app.add_config_value("autoapi_add_objects_to_toctree", True, "html")
app.add_autodocumenter(documenters.AutoapiFunctionDocumenter)
app.add_autodocumenter(documenters.AutoapiPropertyDocumenter)
app.add_autodocumenter(documenters.AutoapiDecoratorDocumenter)
Expand Down
164 changes: 0 additions & 164 deletions autoapi/toctree.py

This file was deleted.

2 changes: 2 additions & 0 deletions docs/changes/+toctree.removal.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Removed the option to have autoapi generate toctree entries for domain objects.
Dropped support for sphinx < 5.2.0.
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ install_requires =
astroid>=2.7
Jinja2
PyYAML
sphinx>=4.0
sphinx>=5.2.0
unidecode

[options.extras_require]
Expand Down
4 changes: 3 additions & 1 deletion tests/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,9 @@ def test_toctree_domain_insertion(self):
"""
Test that the example_function gets added to the TOC Tree
"""
self._run_test("toctreeexample", "_build/text/index.txt", "* example_function")
self._run_test(
"toctreeexample", "_build/text/index.txt", '* "example_function()"'
)


class TestExtensionErrors:
Expand Down

0 comments on commit 6b16e02

Please sign in to comment.