Skip to content

Commit 24cdd0c

Browse files
cgohlkergommers
authored andcommitted
Delay import of Sphinx (#248)
* Delay import of Sphinx * ENH: do not import Sphinx unless it has already been imported * Delay import of Sphinx (cherry picked from commit 4978673)
1 parent 8efdc7b commit 24cdd0c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

numpydoc/docscrape.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
import copy
1717
import sys
1818

19-
from sphinx.ext.autodoc import ALL
2019

2120
def strip_blank_lines(l):
2221
"Remove leading and trailing blank lines from a list of lines"
@@ -626,6 +625,11 @@ def __init__(self, cls, doc=None, modulename='', func_doc=FunctionDoc,
626625
raise ValueError("Expected a class or None, but got %r" % cls)
627626
self._cls = cls
628627

628+
if 'sphinx' in sys.modules:
629+
from sphinx.ext.autodoc import ALL
630+
else:
631+
ALL = object()
632+
629633
self.show_inherited_members = config.get(
630634
'show_inherited_class_members', True)
631635

0 commit comments

Comments
 (0)