From 781a39870b179b3aa80a2fa1e0398b3023936d82 Mon Sep 17 00:00:00 2001 From: Dan Crankshaw Date: Fri, 1 Sep 2017 22:50:12 -0700 Subject: [PATCH] Fixes readthedocs documentation (#278) * update conf * Added requirements file * updated reqs file * update reqs * catch pyspark import exception to make docs build * try mocking out pyspark * revert pyspark import change * format code * Show Python style violates in check_format.sh --- bin/check_format.sh | 2 ++ clipper_admin/docs/conf.py | 16 ++++++++++++++-- clipper_admin/requirements.txt | 7 +++++++ 3 files changed, 23 insertions(+), 2 deletions(-) create mode 100644 clipper_admin/requirements.txt diff --git a/bin/check_format.sh b/bin/check_format.sh index e811a56f3..8c61a3488 100755 --- a/bin/check_format.sh +++ b/bin/check_format.sh @@ -58,6 +58,8 @@ if [ $num_py_violations -eq 0 ]; then echo "Passed Python PEP8 check" else echo "Found $num_py_violations Python PEP8 format violations" + find . -name '*.py' -print | egrep -v "yapf|ycm|googletest" \ + | xargs python $CLIPPER_ROOT/bin/yapf/yapf -d exit 1 fi diff --git a/clipper_admin/docs/conf.py b/clipper_admin/docs/conf.py index 5e8107627..8cd157ac9 100644 --- a/clipper_admin/docs/conf.py +++ b/clipper_admin/docs/conf.py @@ -34,10 +34,22 @@ import sys import os -import shlex +# import shlex import sphinx_rtd_theme +from mock import Mock as MagicMock + + +class Mock(MagicMock): + @classmethod + def __getattr__(cls, name): + return MagicMock() + + +MOCK_MODULES = ['pyspark'] +sys.modules.update((mod_name, Mock()) for mod_name in MOCK_MODULES) + # 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. @@ -115,7 +127,7 @@ # 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'] # -- Options for HTMLHelp output ------------------------------------------ diff --git a/clipper_admin/requirements.txt b/clipper_admin/requirements.txt new file mode 100644 index 000000000..61013786c --- /dev/null +++ b/clipper_admin/requirements.txt @@ -0,0 +1,7 @@ +requests==2.18.4 +subprocess32==3.2.7 +pyyaml==3.12 +docker==2.5.1 +kubernetes==3.0.0 +six==1.10.0 +mock