Skip to content

Commit fb070f9

Browse files
committed
MAINT: Make app setup optional in __init__.
1 parent 8a51c0a commit fb070f9

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

numpydoc/__init__.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,16 @@
66
from ._version import __version__
77

88

9-
def setup(app, *args, **kwargs):
10-
from .numpydoc import setup
9+
# NOTE: Determine whether sphinx is installed with an explicit import.
10+
# If so, define the setup function for registering the numpydoc extension;
11+
# otherwise skip this step.
12+
try:
13+
import sphinx
1114

12-
return setup(app, *args, **kwargs)
15+
16+
def setup(app, *args, **kwargs):
17+
from .numpydoc import setup
18+
19+
return setup(app, *args, **kwargs)
20+
except ModuleNotFoundError:
21+
pass

0 commit comments

Comments
 (0)