Skip to content

Commit 5ce3364

Browse files
committed
Correctly generate API docs with Sphinx on readthedocs
See readthedocs/readthedocs.org#5512
1 parent c123a5b commit 5ce3364

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

doc/conf.py

+4
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@
4343
# NOT to sort autodoc functions in alphabetical order
4444
autodoc_member_order = 'bysource'
4545

46+
# To avoid installing xESMF and all its dependencies when building doc
47+
# https://stackoverflow.com/a/15912502/8729698
48+
autodoc_mock_imports = ['numpy', 'xarray', 'scipy', 'ESMF']
49+
4650
# avoid automatic execution for notebooks
4751
nbsphinx_execute = 'never'
4852

doc/requirements.txt

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
numpydoc
22
ipython
33
nbsphinx
4+
git+https://github.com/JiaweiZhuang/xESMF

setup.py

+9-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from setuptools import setup, find_packages
2+
import os
23

34
VERSION = '0.1.1'
45
DISTNAME = 'xesmf'
@@ -8,7 +9,14 @@
89
URL = 'https://github.com/JiaweiZhuang/xESMF'
910
LICENSE = 'MIT'
1011
PYTHON_REQUIRES = '>=3.5'
11-
INSTALL_REQUIRES = ['esmpy', 'xarray', 'numpy', 'scipy']
12+
13+
# https://github.com/rtfd/readthedocs.org/issues/5512#issuecomment-475024373
14+
on_rtd = os.environ.get('READTHEDOCS') == 'True'
15+
if on_rtd:
16+
INSTALL_REQUIRES = []
17+
else:
18+
INSTALL_REQUIRES = ['esmpy', 'xarray', 'numpy', 'scipy']
19+
1220
CLASSIFIERS = [
1321
'Development Status :: 4 - Beta',
1422
'License :: OSI Approved :: MIT License',

0 commit comments

Comments
 (0)