Skip to content

Commit 66f6fd0

Browse files
author
martinvanhensbergen
authored
Add documentation testing tooling
Add tox commands to generate API documentation for previewing in browser and automatic checking of broken URLs. (DIS-1888)
1 parent ea5f682 commit 66f6fd0

File tree

5 files changed

+88
-0
lines changed

5 files changed

+88
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,6 @@ dist/
66
*.pyc
77
__pycache__/
88
.pytest_cache/
9+
tests/docs/api
10+
tests/docs/build
911
.tox/

tests/docs/Makefile

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Minimal makefile for Sphinx documentation
2+
#
3+
4+
# You can set these variables from the command line, and also
5+
# from the environment for the first two.
6+
SPHINXOPTS ?= -jauto
7+
SPHINXBUILD ?= sphinx-build
8+
SOURCEDIR = .
9+
BUILDDIR = build
10+
11+
# Put it first so that "make" without argument is like "make help".
12+
help:
13+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14+
15+
.PHONY: clean help Makefile
16+
17+
clean: Makefile
18+
rm -rf api
19+
@$(SPHINXBUILD) -M clean "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
20+
21+
# Catch-all target: route all unknown targets to Sphinx using the new
22+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
23+
%: Makefile
24+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

tests/docs/conf.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
extensions = [
2+
"autoapi.extension",
3+
"sphinx.ext.autodoc",
4+
"sphinx.ext.autosectionlabel",
5+
"sphinx.ext.doctest",
6+
"sphinx.ext.napoleon",
7+
"sphinx_argparse_cli",
8+
]
9+
10+
exclude_patterns = []
11+
12+
html_theme = "furo"
13+
14+
autoapi_type = "python"
15+
autoapi_dirs = ["../../dissect/"]
16+
autoapi_ignore = ["*tests*", "*.tox*", "*venv*", "*examples*"]
17+
autoapi_python_use_implicit_namespaces = True
18+
autoapi_add_toctree_entry = False
19+
autoapi_root = "api"
20+
autoapi_options = [
21+
"members",
22+
"undoc-members",
23+
"show-inheritance",
24+
"show-module-summary",
25+
"special-members",
26+
"imported-members",
27+
]
28+
autoapi_keep_files = True
29+
autoapi_template_dir = "_templates/autoapi"
30+
31+
autodoc_typehints = "signature"
32+
autodoc_member_order = "groupwise"
33+
34+
autosectionlabel_prefix_document = True

tests/docs/index.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
API Reference
2+
=============
3+
4+
.. toctree::
5+
:maxdepth: 1
6+
:glob:
7+
8+
/api/*/*/index

tox.ini

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,23 @@ extend-ignore =
5555
# See https://github.com/PyCQA/pycodestyle/issues/373
5656
E203,
5757
statistics = True
58+
59+
[testenv:docs-build]
60+
allowlist_externals = make
61+
deps =
62+
sphinx
63+
sphinx-autoapi
64+
sphinx_argparse_cli
65+
sphinx-copybutton
66+
sphinx-design
67+
furo
68+
commands =
69+
make -C tests/docs clean
70+
make -C tests/docs html
71+
72+
[testenv:docs-linkcheck]
73+
allowlist_externals = make
74+
deps = {[testenv:docs-build]deps}
75+
commands =
76+
make -C tests/docs clean
77+
make -C tests/docs linkcheck

0 commit comments

Comments
 (0)