Skip to content

Commit 2e3f4ec

Browse files
datapythonistajorisvandenbossche
authored andcommitted
DOC: Loading sphinxcontrib.spelling to sphinx only if it's available (#21397)
1 parent 1275f91 commit 2e3f4ec

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

ci/environment-dev.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ dependencies:
1313
- pytz
1414
- setuptools>=24.2.0
1515
- sphinx
16+
- sphinxcontrib-spelling

ci/requirements_dev.txt

+1
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ python-dateutil>=2.5.0
99
pytz
1010
setuptools>=24.2.0
1111
sphinx
12+
sphinxcontrib-spelling

doc/source/conf.py

+11-2
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,11 @@
1616
import re
1717
import inspect
1818
import importlib
19-
from sphinx.ext.autosummary import _import_by_name
19+
import logging
2020
import warnings
21+
from sphinx.ext.autosummary import _import_by_name
2122

23+
logger = logging.getLogger(__name__)
2224

2325
try:
2426
raw_input # Python 2
@@ -73,9 +75,16 @@
7375
'sphinx.ext.ifconfig',
7476
'sphinx.ext.linkcode',
7577
'nbsphinx',
76-
'sphinxcontrib.spelling'
7778
]
7879

80+
try:
81+
import sphinxcontrib.spelling
82+
except ImportError as err:
83+
logger.warn(('sphinxcontrib.spelling failed to import with error "{}". '
84+
'`spellcheck` command is not available.'.format(err)))
85+
else:
86+
extensions.append('sphinxcontrib.spelling')
87+
7988
exclude_patterns = ['**.ipynb_checkpoints']
8089

8190
spelling_word_list_filename = ['spelling_wordlist.txt', 'names_wordlist.txt']

0 commit comments

Comments
 (0)