From 929f7abd08a57d65771bbd60a4ee77d649969e3d Mon Sep 17 00:00:00 2001 From: Antony Lee Date: Tue, 23 Oct 2018 23:33:48 +0200 Subject: [PATCH] Move setup of autosummary earlier in setup(). `setup()` calls `app.setup_extension('sphinx.ext.autosummary')` so that end users who add numpydoc to their extension list don't need to declare a dependency on autosummary, but we may just as well move the call to setup_extension even earlier, which also removes the need to declare a dependency on autodoc (as autosummary will initialize it). Otherwise, users need to be careful to have autodoc *before* numpydoc in their extension list; without that they get an "Unknown event name: autodoc-process-docstring" error. --- numpydoc/numpydoc.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/numpydoc/numpydoc.py b/numpydoc/numpydoc.py index 763c022d..adbdc5fd 100644 --- a/numpydoc/numpydoc.py +++ b/numpydoc/numpydoc.py @@ -176,6 +176,8 @@ def setup(app, get_doc_object_=get_doc_object): global get_doc_object get_doc_object = get_doc_object_ + app.setup_extension('sphinx.ext.autosummary') + app.connect('autodoc-process-docstring', mangle_docstrings) app.connect('autodoc-process-signature', mangle_signature) app.connect('doctree-read', relabel_references) @@ -191,8 +193,6 @@ def setup(app, get_doc_object_=get_doc_object): app.add_domain(NumpyPythonDomain) app.add_domain(NumpyCDomain) - app.setup_extension('sphinx.ext.autosummary') - metadata = {'version': __version__, 'parallel_read_safe': True} return metadata