Skip to content

Commit ce5f547

Browse files
committed
feature: add adobe analytics script; upgrade sphinx to support custom js
1 parent 9ae28d7 commit ce5f547

File tree

4 files changed

+46
-8
lines changed

4 files changed

+46
-8
lines changed

README.rst

+37
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,43 @@ You can also run them in parallel:
155155
tox -- -n auto tests/integ
156156

157157

158+
Building Sphinx docs
159+
~~~~~~~~~~~~~~~~~~~~
160+
161+
Setup a Python environment with ``sphinx`` and ``sagemaker``:
162+
163+
::
164+
165+
conda create -n sagemaker python=3.7
166+
conda activate sagemaker
167+
conda install sphinx==2.2.2
168+
pip install sagemaker --user
169+
170+
Install the Read The Docs theme:
171+
172+
::
173+
174+
pip install sphinx_rtd_theme --user
175+
176+
177+
Clone/fork the repo, ``cd`` into the ``sagemaker-python-sdk/doc`` directory and run:
178+
179+
::
180+
181+
make html
182+
183+
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.
184+
185+
Preview the site with a Python web server:
186+
187+
::
188+
189+
cd _build/html
190+
python -m http.server 8000
191+
192+
View the website by visiting http://localhost:8000
193+
194+
158195
MXNet SageMaker Estimators
159196
--------------------------
160197

doc/_static/js/analytics.js

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
console.log("Starting analytics...");
2+
var s_code=s.t();if(s_code)document.write(s_code)

doc/conf.py

+5-6
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
"""Placeholder docstring"""
1414
from __future__ import absolute_import
1515

16-
import os
1716
import pkg_resources
1817
import sys
1918
from datetime import datetime
@@ -83,13 +82,13 @@ def __getattr__(cls, name):
8382
autodoc_default_flags = ["show-inheritance", "members", "undoc-members"]
8483
autodoc_member_order = "bysource"
8584

86-
if "READTHEDOCS" in os.environ:
87-
html_theme = "default"
88-
else:
89-
html_theme = "haiku"
90-
html_static_path = []
85+
html_theme = "sphinx_rtd_theme"
86+
87+
html_static_path = ["_static"]
9188
htmlhelp_basename = "%sdoc" % project
9289

90+
html_js_files = ["https://a0.awsstatic.com/s_code/js/1.0/awshome_s_code.js", "js/analytics.js"]
91+
9392
# Example configuration for intersphinx: refer to the Python standard library.
9493
intersphinx_mapping = {"http://docs.python.org/": None}
9594

doc/requirements.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
sphinx==1.7.9
1+
sphinx==2.2.2
22
numpy
33
scipy
4-
requests==2.20
4+
requests==2.20

0 commit comments

Comments
 (0)