Skip to content

Commit

Permalink
documentation: Get Read the Docs working (#46)
Browse files Browse the repository at this point in the history
Fixed previously failing Read the Docs builds by:
1. Explicity adding `method` and `path` to .readthedocs.yml; this was causing builds to fail altogether
2. Using [sphinxcontrib-apidoc](https://github.com/sphinx-contrib/apidoc) instead autodoc directly (see readthedocs/readthedocs.org#1139). Defore, our `tox -e docs` command would run `aphinx-apidoc` then `sphinx-build`. However, Read the Docs only runs `sphinx-build`, so the module docs would never get generated.
  • Loading branch information
speller26 authored Aug 14, 2020
1 parent f8e636a commit 0d80a54
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,6 @@ formats:
python:
version: 3.7
install:
- method: pip
path: .
- requirements: doc/requirements.txt
8 changes: 8 additions & 0 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
copyright = "{}, Amazon.com".format(datetime.datetime.now().year)

extensions = [
"sphinxcontrib.apidoc",
"sphinx.ext.autodoc",
"sphinx.ext.viewcode",
"sphinx.ext.napoleon",
Expand All @@ -29,6 +30,13 @@

napoleon_use_rtype = False

apidoc_module_dir = "../src/braket"
apidoc_output_dir = "_apidoc"
apidoc_excluded_paths = ["../test"]
apidoc_separate_modules = True
apidoc_module_first = True
apidoc_extra_args = ["-f", "--implicit-namespaces", "-H", "API Reference"]


# -- Options for MathJax output -------------------------------------------

Expand Down
1 change: 1 addition & 0 deletions doc/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
sphinx
sphinx-rtd-theme
sphinxcontrib-apidoc
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"pytest-xdist",
"sphinx",
"sphinx-rtd-theme",
"sphinxcontrib-apidoc",
"tox",
]
},
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ basepython = python3.7
deps =
sphinx
sphinx-rtd-theme
sphinxcontrib-apidoc
commands =
sphinx-apidoc -e -f -M --implicit-namespaces -H "API Reference" -o doc/_apidoc src/braket
sphinx-build -E -T -b html doc build/documentation/html

[testenv:serve-docs]
Expand Down

0 comments on commit 0d80a54

Please sign in to comment.