Skip to content

Commit 0d80a54

Browse files
authored
documentation: Get Read the Docs working (#46)
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.
1 parent f8e636a commit 0d80a54

File tree

5 files changed

+13
-1
lines changed

5 files changed

+13
-1
lines changed

.readthedocs.yml

+2
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,6 @@ formats:
1717
python:
1818
version: 3.7
1919
install:
20+
- method: pip
21+
path: .
2022
- requirements: doc/requirements.txt

doc/conf.py

+8
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
copyright = "{}, Amazon.com".format(datetime.datetime.now().year)
1111

1212
extensions = [
13+
"sphinxcontrib.apidoc",
1314
"sphinx.ext.autodoc",
1415
"sphinx.ext.viewcode",
1516
"sphinx.ext.napoleon",
@@ -29,6 +30,13 @@
2930

3031
napoleon_use_rtype = False
3132

33+
apidoc_module_dir = "../src/braket"
34+
apidoc_output_dir = "_apidoc"
35+
apidoc_excluded_paths = ["../test"]
36+
apidoc_separate_modules = True
37+
apidoc_module_first = True
38+
apidoc_extra_args = ["-f", "--implicit-namespaces", "-H", "API Reference"]
39+
3240

3341
# -- Options for MathJax output -------------------------------------------
3442

doc/requirements.txt

+1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
sphinx
22
sphinx-rtd-theme
3+
sphinxcontrib-apidoc

setup.py

+1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
"pytest-xdist",
4343
"sphinx",
4444
"sphinx-rtd-theme",
45+
"sphinxcontrib-apidoc",
4546
"tox",
4647
]
4748
},

tox.ini

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ basepython = python3.7
5353
deps =
5454
sphinx
5555
sphinx-rtd-theme
56+
sphinxcontrib-apidoc
5657
commands =
57-
sphinx-apidoc -e -f -M --implicit-namespaces -H "API Reference" -o doc/_apidoc src/braket
5858
sphinx-build -E -T -b html doc build/documentation/html
5959

6060
[testenv:serve-docs]

0 commit comments

Comments
 (0)