From 3d04b9511e99dd24d1eb0261947806f34aa311e9 Mon Sep 17 00:00:00 2001 From: Aaron Markham Date: Wed, 15 Jan 2020 13:45:32 -0800 Subject: [PATCH 1/2] change: turn on warnings as errors for docs builds --- doc/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/Makefile b/doc/Makefile index ae8e0e79c4..1cdfaa77df 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -2,8 +2,8 @@ # # You can set these variables from the command line. -SPHINXOPTS = -SPHINXBUILD = python -msphinx +SPHINXOPTS = -W +SPHINXBUILD = python -msphinx SPHINXPROJ = sagemaker SOURCEDIR = . BUILDDIR = _build @@ -17,4 +17,4 @@ help: # Catch-all target: route all unknown targets to Sphinx using the new # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). %: Makefile - @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) \ No newline at end of file + @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) From ce5f547782d817071c1919d8601e4587b52d33e2 Mon Sep 17 00:00:00 2001 From: Aaron Markham Date: Fri, 10 Apr 2020 17:40:22 -0700 Subject: [PATCH 2/2] feature: add adobe analytics script; upgrade sphinx to support custom js --- README.rst | 37 +++++++++++++++++++++++++++++++++++++ doc/_static/js/analytics.js | 2 ++ doc/conf.py | 11 +++++------ doc/requirements.txt | 4 ++-- 4 files changed, 46 insertions(+), 8 deletions(-) create mode 100644 doc/_static/js/analytics.js diff --git a/README.rst b/README.rst index d097a9e98e..916eb1a861 100644 --- a/README.rst +++ b/README.rst @@ -155,6 +155,43 @@ You can also run them in parallel: tox -- -n auto tests/integ +Building Sphinx docs +~~~~~~~~~~~~~~~~~~~~ + +Setup a Python environment with ``sphinx`` and ``sagemaker``: + +:: + + conda create -n sagemaker python=3.7 + conda activate sagemaker + conda install sphinx==2.2.2 + pip install sagemaker --user + +Install the Read The Docs theme: + +:: + + pip install sphinx_rtd_theme --user + + +Clone/fork the repo, ``cd`` into the ``sagemaker-python-sdk/doc`` directory and run: + +:: + + make html + +You can edit the templates for any of the pages in the docs by editing the .rst files in the ``doc`` directory and then running ``make html`` again. + +Preview the site with a Python web server: + +:: + + cd _build/html + python -m http.server 8000 + +View the website by visiting http://localhost:8000 + + MXNet SageMaker Estimators -------------------------- diff --git a/doc/_static/js/analytics.js b/doc/_static/js/analytics.js new file mode 100644 index 0000000000..2160956952 --- /dev/null +++ b/doc/_static/js/analytics.js @@ -0,0 +1,2 @@ +console.log("Starting analytics..."); +var s_code=s.t();if(s_code)document.write(s_code) diff --git a/doc/conf.py b/doc/conf.py index a60d919712..8217051646 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -13,7 +13,6 @@ """Placeholder docstring""" from __future__ import absolute_import -import os import pkg_resources import sys from datetime import datetime @@ -83,13 +82,13 @@ def __getattr__(cls, name): autodoc_default_flags = ["show-inheritance", "members", "undoc-members"] autodoc_member_order = "bysource" -if "READTHEDOCS" in os.environ: - html_theme = "default" -else: - html_theme = "haiku" -html_static_path = [] +html_theme = "sphinx_rtd_theme" + +html_static_path = ["_static"] htmlhelp_basename = "%sdoc" % project +html_js_files = ["https://a0.awsstatic.com/s_code/js/1.0/awshome_s_code.js", "js/analytics.js"] + # Example configuration for intersphinx: refer to the Python standard library. intersphinx_mapping = {"http://docs.python.org/": None} diff --git a/doc/requirements.txt b/doc/requirements.txt index 5d88004db9..070ee329f5 100644 --- a/doc/requirements.txt +++ b/doc/requirements.txt @@ -1,4 +1,4 @@ -sphinx==1.7.9 +sphinx==2.2.2 numpy scipy -requests==2.20 \ No newline at end of file +requests==2.20