Skip to content

Commit 0755a61

Browse files
authored
enable make docs (#666)
Add ability to run `make docs` to build sphinx documentation for devstack that will be published to readthedocs.
1 parent 6eecf64 commit 0755a61

18 files changed

+1187
-12
lines changed

.readthedocs.yml

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# .readthedocs.yml
2+
# Read the Docs configuration file
3+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
4+
5+
# Required
6+
version: 2
7+
8+
# Build documentation in the docs/ directory with Sphinx
9+
sphinx:
10+
configuration: docs/conf.py
11+
12+
python:
13+
version: 3.8
14+
install:
15+
- requirements: requirements/doc.txt

.travis.yml

+1
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,4 @@ script:
4141
- make dev.provision."$SERVICES"
4242
- make dev.up."$SERVICES"
4343
- make dev.check."$SERVICES"
44+
- make docs

Makefile

+8-3
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
dev.stop dev.sync.daemon.start dev.sync.provision \
5858
dev.sync.requirements dev.sync.up dev.up dev.up.attach dev.up.shell \
5959
dev.up.without-deps dev.up.without-deps.shell dev.up.with-programs \
60-
dev.up.with-watchers dev.validate e2e-tests e2e-tests.with-shell \
60+
dev.up.with-watchers dev.validate docs e2e-tests e2e-tests.with-shell \
6161
help requirements selfcheck upgrade upgrade \
6262
validate-lms-volume vnc-passwords
6363

@@ -156,14 +156,16 @@ help: ## Display this help message.
156156
@echo "Please use \`make <target>' where <target> is one of"
157157
@awk -F ':.*?## ' '/^[a-zA-Z]/ && NF==2 {printf "\033[36m %-28s\033[0m %s\n", $$1, $$2}' Makefile | sort
158158

159-
requirements: ## Install requirements.
160-
pip install -r requirements/base.txt
159+
requirements: ## install development environment requirements
160+
pip install -r requirements/dev.txt
161161

162162
upgrade: export CUSTOM_COMPILE_COMMAND=make upgrade
163163
upgrade: ## Upgrade requirements with pip-tools.
164164
pip install -qr requirements/pip-tools.txt
165165
pip-compile --upgrade -o requirements/pip-tools.txt requirements/pip-tools.in
166166
pip-compile --upgrade -o requirements/base.txt requirements/base.in
167+
pip-compile --upgrade -o requirements/doc.txt requirements/doc.in
168+
pip-compile --upgrade -o requirements/dev.txt requirements/dev.in
167169

168170
selfcheck: ## Check that the Makefile is free of Make syntax errors.
169171
@echo "The Makefile is well-formed."
@@ -577,6 +579,9 @@ _expects-database.%:
577579
# These are useful, but don't fit nicely to the greater Devstack interface.
578580
########################################################################################
579581

582+
docs: ## generate Sphinx HTML documentation, including API docs
583+
tox -e docs
584+
580585
e2e-tests: dev.up.lms+studio ## Run the end-to-end tests against the service containers.
581586
docker run -t --network=$(COMPOSE_PROJECT_NAME)_default -v $(DEVSTACK_WORKSPACE)/edx-e2e-tests:/edx-e2e-tests --env-file $(DEVSTACK_WORKSPACE)/edx-e2e-tests/devstack_env edxops/e2e env TERM=$(TERM) bash -c 'paver e2e_test'
582587

README.rst

+7-3
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,10 @@ The default devstack services can be run by following the steps below.
166166
167167
make dev.pull
168168
169+
.. Update rst to point to readthedocs once published.
170+
169171
Note -
170-
If you are setting up devstack to develop on Open edx named releases, see `instructions<docs/developing_on_named_release_branches.rst>`_ before following this step 3
172+
If you are setting up devstack to develop on Open edx named releases, see ``docs/developing_on_named_release_branches.rst`` before following this step 3
171173
172174
3. Optional: You have an option to use NFS on MacOS which may improve the performance significantly. To set it up ONLY ON MAC, do
173175
.. code:: sh
@@ -484,8 +486,10 @@ Changing the Docker Compose Project Name
484486
The ``COMPOSE_PROJECT_NAME`` variable is used to define Docker namespaced volumes
485487
and network based on this value, so changing it will give you a separate set of databases.
486488
This is handled for you automatically by setting the ``OPENEDX_RELEASE`` environment variable in ``options.mk``
487-
(e.g. ``COMPOSE_PROJECT_NAME=devstack-juniper.master``. Should you want to manually override this, edit the ``options.local.mk`` in the root of this repo and create the file if it does not exist. Change the devstack project name by adding the following line:
488-
``COMPOSE_PROJECT_NAME=<your-alternate-devstack-name>`` (e.g. ``COMPOSE_PROJECT_NAME=secondarydevstack``)
489+
(e.g. ``COMPOSE_PROJECT_NAME=devstack-juniper.master``. Should you want to manually override this, edit the ``options.local.mk`` in the root of this repo and create the file if it does not exist. Change the devstack project name by adding the following line::
490+
491+
# Example: COMPOSE_PROJECT_NAME=secondarydevstack
492+
COMPOSE_PROJECT_NAME=<your-alternate-devstack-name>
489493

490494
As a specific example, if ``OPENEDX_RELEASE`` is set in your environment as ``juniper.master``, then ``COMPOSE_PROJECT_NAME`` will default to ``devstack-juniper.master`` instead of ``devstack``.
491495

docs/Makefile

+230
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,230 @@
1+
# Makefile for Sphinx documentation
2+
#
3+
4+
# You can set these variables from the command line.
5+
SPHINXOPTS =
6+
SPHINXBUILD = sphinx-build
7+
PAPER =
8+
BUILDDIR = _build
9+
10+
# User-friendly check for sphinx-build
11+
ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
12+
$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from https://sphinx-doc.org/)
13+
endif
14+
15+
# Internal variables.
16+
PAPEROPT_a4 = -D latex_paper_size=a4
17+
PAPEROPT_letter = -D latex_paper_size=letter
18+
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
19+
# the i18n builder cannot share the environment and doctrees with the others
20+
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
21+
22+
.PHONY: help
23+
help:
24+
@echo "Please use \`make <target>' where <target> is one of"
25+
@echo " html to make standalone HTML files"
26+
@echo " dirhtml to make HTML files named index.html in directories"
27+
@echo " singlehtml to make a single large HTML file"
28+
@echo " pickle to make pickle files"
29+
@echo " json to make JSON files"
30+
@echo " htmlhelp to make HTML files and a HTML help project"
31+
@echo " qthelp to make HTML files and a qthelp project"
32+
@echo " applehelp to make an Apple Help Book"
33+
@echo " devhelp to make HTML files and a Devhelp project"
34+
@echo " epub to make an epub"
35+
@echo " epub3 to make an epub3"
36+
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
37+
@echo " latexpdf to make LaTeX files and run them through pdflatex"
38+
@echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx"
39+
@echo " text to make text files"
40+
@echo " man to make manual pages"
41+
@echo " texinfo to make Texinfo files"
42+
@echo " info to make Texinfo files and run them through makeinfo"
43+
@echo " gettext to make PO message catalogs"
44+
@echo " changes to make an overview of all changed/added/deprecated items"
45+
@echo " xml to make Docutils-native XML files"
46+
@echo " pseudoxml to make pseudoxml-XML files for display purposes"
47+
@echo " linkcheck to check all external links for integrity"
48+
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
49+
@echo " coverage to run coverage check of the documentation (if enabled)"
50+
@echo " dummy to check syntax errors of document sources"
51+
52+
.PHONY: clean
53+
clean:
54+
rm -rf $(BUILDDIR)/*
55+
56+
.PHONY: html
57+
html:
58+
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
59+
@echo
60+
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
61+
62+
.PHONY: dirhtml
63+
dirhtml:
64+
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
65+
@echo
66+
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
67+
68+
.PHONY: singlehtml
69+
singlehtml:
70+
$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
71+
@echo
72+
@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
73+
74+
.PHONY: pickle
75+
pickle:
76+
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
77+
@echo
78+
@echo "Build finished; now you can process the pickle files."
79+
80+
.PHONY: json
81+
json:
82+
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
83+
@echo
84+
@echo "Build finished; now you can process the JSON files."
85+
86+
.PHONY: htmlhelp
87+
htmlhelp:
88+
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
89+
@echo
90+
@echo "Build finished; now you can run HTML Help Workshop with the" \
91+
".hhp project file in $(BUILDDIR)/htmlhelp."
92+
93+
.PHONY: qthelp
94+
qthelp:
95+
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
96+
@echo
97+
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
98+
".qhcp project file in $(BUILDDIR)/qthelp, like this:"
99+
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/devstack.qhcp"
100+
@echo "To view the help file:"
101+
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/devstack.qhc"
102+
103+
.PHONY: applehelp
104+
applehelp:
105+
$(SPHINXBUILD) -b applehelp $(ALLSPHINXOPTS) $(BUILDDIR)/applehelp
106+
@echo
107+
@echo "Build finished. The help book is in $(BUILDDIR)/applehelp."
108+
@echo "N.B. You won't be able to view it unless you put it in" \
109+
"~/Library/Documentation/Help or install it in your application" \
110+
"bundle."
111+
112+
.PHONY: devhelp
113+
devhelp:
114+
$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
115+
@echo
116+
@echo "Build finished."
117+
@echo "To view the help file:"
118+
@echo "# mkdir -p $$HOME/.local/share/devhelp/devstack"
119+
@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/devstack"
120+
@echo "# devhelp"
121+
122+
.PHONY: epub
123+
epub:
124+
$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
125+
@echo
126+
@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
127+
128+
.PHONY: epub3
129+
epub3:
130+
$(SPHINXBUILD) -b epub3 $(ALLSPHINXOPTS) $(BUILDDIR)/epub3
131+
@echo
132+
@echo "Build finished. The epub3 file is in $(BUILDDIR)/epub3."
133+
134+
.PHONY: latex
135+
latex:
136+
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
137+
@echo
138+
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
139+
@echo "Run \`make' in that directory to run these through (pdf)latex" \
140+
"(use \`make latexpdf' here to do that automatically)."
141+
142+
.PHONY: latexpdf
143+
latexpdf:
144+
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
145+
@echo "Running LaTeX files through pdflatex..."
146+
$(MAKE) -C $(BUILDDIR)/latex all-pdf
147+
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
148+
149+
.PHONY: latexpdfja
150+
latexpdfja:
151+
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
152+
@echo "Running LaTeX files through platex and dvipdfmx..."
153+
$(MAKE) -C $(BUILDDIR)/latex all-pdf-ja
154+
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
155+
156+
.PHONY: text
157+
text:
158+
$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
159+
@echo
160+
@echo "Build finished. The text files are in $(BUILDDIR)/text."
161+
162+
.PHONY: man
163+
man:
164+
$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
165+
@echo
166+
@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
167+
168+
.PHONY: texinfo
169+
texinfo:
170+
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
171+
@echo
172+
@echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
173+
@echo "Run \`make' in that directory to run these through makeinfo" \
174+
"(use \`make info' here to do that automatically)."
175+
176+
.PHONY: info
177+
info:
178+
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
179+
@echo "Running Texinfo files through makeinfo..."
180+
make -C $(BUILDDIR)/texinfo info
181+
@echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
182+
183+
.PHONY: gettext
184+
gettext:
185+
$(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
186+
@echo
187+
@echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
188+
189+
.PHONY: changes
190+
changes:
191+
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
192+
@echo
193+
@echo "The overview file is in $(BUILDDIR)/changes."
194+
195+
.PHONY: linkcheck
196+
linkcheck:
197+
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
198+
@echo
199+
@echo "Link check complete; look for any errors in the above output " \
200+
"or in $(BUILDDIR)/linkcheck/output.txt."
201+
202+
.PHONY: doctest
203+
doctest:
204+
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
205+
@echo "Testing of doctests in the sources finished, look at the " \
206+
"results in $(BUILDDIR)/doctest/output.txt."
207+
208+
.PHONY: coverage
209+
coverage:
210+
$(SPHINXBUILD) -b coverage $(ALLSPHINXOPTS) $(BUILDDIR)/coverage
211+
@echo "Testing of coverage in the sources finished, look at the " \
212+
"results in $(BUILDDIR)/coverage/python.txt."
213+
214+
.PHONY: xml
215+
xml:
216+
$(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml
217+
@echo
218+
@echo "Build finished. The XML files are in $(BUILDDIR)/xml."
219+
220+
.PHONY: pseudoxml
221+
pseudoxml:
222+
$(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml
223+
@echo
224+
@echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."
225+
226+
.PHONY: dummy
227+
dummy:
228+
$(SPHINXBUILD) -b dummy $(ALLSPHINXOPTS) $(BUILDDIR)/dummy
229+
@echo
230+
@echo "Build finished. Dummy builder generates no files."

0 commit comments

Comments
 (0)