Skip to content

Commit

Permalink
add a bunch of mocks to hopefully fix the rtd build
Browse files Browse the repository at this point in the history
  • Loading branch information
snowman2 committed May 9, 2019
1 parent e8a8c22 commit b64d6d1
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 53 deletions.
121 changes: 73 additions & 48 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,45 @@
#
import os
import sys
sys.path.insert(0, os.path.abspath('..'))

# -- General configuration ------------------------------------------------
##TEMP SECTION UNTIL RTREE WORKS IN CONDA IN RTD
#SEE: http://docs.readthedocs.io/en/latest/faq.html#i-get-import-errors-on-libraries-that-depend-on-c-modules
# SEE: http://docs.readthedocs.io/en/latest/faq.html#i-get-import-errors-on-libraries-that-depend-on-c-modules
from mock import Mock as MagicMock

sys.path.insert(0, os.path.abspath(".."))


class Mock(MagicMock):
@classmethod
def __getattr__(cls, name):
return Mock()
return Mock()


MOCK_MODULES = [
"rtree",
"dateutil.parser",
"numpy",
"numpy.ma",
"numpy.testing",
"xarray",
"netCDF4",
"pandas",
"past.builtins",
"pangaea",
"osgeo",
"pyproj",
"shapely",
"shapely.geometry",
"shapely.geos",
"shapely.ops",
"shapely.wkb",
"gazar",
"gazar.grid",
"scipy",
"scipy.spatial",
]

MOCK_MODULES = ['rtree']
sys.modules.update((mod_name, Mock()) for mod_name in MOCK_MODULES)
##END TEMP SECTION UNTIL RTREE WORKS IN CONDA IN RTD

Expand All @@ -42,46 +68,46 @@ def __getattr__(cls, name):
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.todo',
'sphinx.ext.coverage',
'sphinx.ext.mathjax',
'sphinx.ext.viewcode',
'sphinxcontrib.napoleon',
"sphinx.ext.autodoc",
"sphinx.ext.todo",
"sphinx.ext.coverage",
"sphinx.ext.mathjax",
"sphinx.ext.viewcode",
"sphinxcontrib.napoleon",
]

# Napoleon settings
napoleon_numpy_docstring = True

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
templates_path = ["_templates"]

# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
#
# source_suffix = ['.rst', '.md']
source_suffix = '.rst'
source_suffix = ".rst"

# The encoding of source files.
#
# source_encoding = 'utf-8-sig'

# The master toctree document.
master_doc = 'index'
master_doc = "index"

# General information about the project.
project = u'RAPIDpy'
copyright = u'2016, Alan D. Snow'
author = u'Alan D. Snow'
project = u"RAPIDpy"
copyright = u"2016, Alan D. Snow"
author = u"Alan D. Snow"

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = u'2.6.0'
version = u"2.6.0"
# The full version, including alpha/beta/rc tags.
release = u'2.6.0'
release = u"2.6.0"

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand All @@ -102,7 +128,7 @@ def __getattr__(cls, name):
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This patterns also effect to html_static_path and html_extra_path
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]

# The reST default role (used for this markup: `text`) to use for all
# documents.
Expand All @@ -124,7 +150,7 @@ def __getattr__(cls, name):
# show_authors = False

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
pygments_style = "sphinx"

# A list of ignored prefixes for module index sorting.
# modindex_common_prefix = []
Expand All @@ -141,7 +167,7 @@ def __getattr__(cls, name):
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'default'
html_theme = "default"

# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
Expand Down Expand Up @@ -175,7 +201,7 @@ def __getattr__(cls, name):
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
# html_static_path = ["_static"]

# Add any extra paths that contain custom files (such as robots.txt or
# .htaccess) here, relative to this directory. These files are copied
Expand All @@ -187,7 +213,7 @@ def __getattr__(cls, name):
# bottom, using the given strftime format.
# The empty string is equivalent to '%b %d, %Y'.
#
html_last_updated_fmt = ''
html_last_updated_fmt = ""

# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
Expand Down Expand Up @@ -255,34 +281,30 @@ def __getattr__(cls, name):
# html_search_scorer = 'scorer.js'

# Output file base name for HTML help builder.
htmlhelp_basename = 'RAPIDpydoc'
htmlhelp_basename = "RAPIDpydoc"

# -- Options for LaTeX output ---------------------------------------------

latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#
# 'papersize': 'letterpaper',

# The font size ('10pt', '11pt' or '12pt').
#
# 'pointsize': '10pt',

# Additional stuff for the LaTeX preamble.
#
# 'preamble': '',

# Latex figure (float) alignment
#
# 'figure_align': 'htbp',
# The paper size ('letterpaper' or 'a4paper').
#
# 'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
#
# 'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
#
# 'preamble': '',
# Latex figure (float) alignment
#
# 'figure_align': 'htbp',
}

# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'RAPIDpy.tex', u'RAPIDpy Documentation',
u'Alan D. Snow', 'manual'),
(master_doc, "RAPIDpy.tex", u"RAPIDpy Documentation", u"Alan D. Snow", "manual")
]

# The name of an image file (relative to this directory) to place at the top of
Expand Down Expand Up @@ -322,10 +344,7 @@ def __getattr__(cls, name):

# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, 'rapidpy', u'RAPIDpy Documentation',
[author], 1)
]
man_pages = [(master_doc, "rapidpy", u"RAPIDpy Documentation", [author], 1)]

# If true, show URL addresses after external links.
#
Expand All @@ -338,9 +357,15 @@ def __getattr__(cls, name):
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'RAPIDpy', u'RAPIDpy Documentation',
author, 'RAPIDpy', 'One line description of project.',
'Miscellaneous'),
(
master_doc,
"RAPIDpy",
u"RAPIDpy Documentation",
author,
"RAPIDpy",
"One line description of project.",
"Miscellaneous",
)
]

# Documents to append as an appendix to all manuals.
Expand Down
7 changes: 2 additions & 5 deletions readthedocs.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
conda:
file: conda-env.yml
python:
version: 2
pip_install: true
extra_requirements:
- docs
pip_install: false
requirements_file: requirements.readthedocs.txt
1 change: 1 addition & 0 deletions requirements.readthedocs.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
sphinxcontrib-napoleon

0 comments on commit b64d6d1

Please sign in to comment.