Skip to content

Commit

Permalink
building docs skips numpy,scipy,pandas,dill,h5py imports
Browse files Browse the repository at this point in the history
  • Loading branch information
dereneaton committed Nov 4, 2015
1 parent a6da10e commit 4d5d150
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,34 @@
#sys.path.insert(0, os.path.abspath('.'))
sys.path.insert(0, os.path.abspath(".."))


# Provide stubs for external dependencies, so we can generate our reference
# documentation without having to install them.
class module_proxy(object):
__all__ = []

def __init__(self, *args, **kwargs):
pass

def __call__(self, *args, **kwargs):
return module_proxy()

@classmethod
def __getattr__(cls, name):
if name in ("__file__", "__path__"):
return "/dev/null"
elif name[0] == name[0].upper():
proxy_type = type(name, (), {})
proxy_type.__module__ = __name__
return proxy_type
else:
return module_proxy()

MODULES = ["numpy", "scipy", "pandas", "dill", "h5py"]
for module_name in MODULES:
sys.modules[module_name] = module_proxy()


# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
Expand Down

0 comments on commit 4d5d150

Please sign in to comment.