Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add documentation testing tooling #16

Merged
merged 2 commits into from
May 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ dist/
*.pyc
__pycache__/
.pytest_cache/
tests/docs/api
tests/docs/build
.tox/
24 changes: 24 additions & 0 deletions tests/docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?= -jauto
SPHINXBUILD ?= sphinx-build
SOURCEDIR = .
BUILDDIR = build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: clean help Makefile

clean: Makefile
rm -rf api
@$(SPHINXBUILD) -M clean "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
34 changes: 34 additions & 0 deletions tests/docs/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
extensions = [
"autoapi.extension",
"sphinx.ext.autodoc",
"sphinx.ext.autosectionlabel",
"sphinx.ext.doctest",
"sphinx.ext.napoleon",
"sphinx_argparse_cli",
]

exclude_patterns = []

html_theme = "furo"

autoapi_type = "python"
autoapi_dirs = ["../../dissect/"]
autoapi_ignore = ["*tests*", "*.tox*", "*venv*", "*examples*"]
autoapi_python_use_implicit_namespaces = True
autoapi_add_toctree_entry = False
autoapi_root = "api"
autoapi_options = [
"members",
"undoc-members",
"show-inheritance",
"show-module-summary",
"special-members",
"imported-members",
]
autoapi_keep_files = True
autoapi_template_dir = "_templates/autoapi"

autodoc_typehints = "signature"
autodoc_member_order = "groupwise"

autosectionlabel_prefix_document = True
8 changes: 8 additions & 0 deletions tests/docs/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
API Reference
=============

.. toctree::
:maxdepth: 1
:glob:

/api/*/*/index
20 changes: 20 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,23 @@ extend-ignore =
# See https://github.com/PyCQA/pycodestyle/issues/373
E203,
statistics = True

[testenv:docs-build]
allowlist_externals = make
deps =
sphinx
sphinx-autoapi
sphinx_argparse_cli
sphinx-copybutton
sphinx-design
furo
commands =
make -C tests/docs clean
make -C tests/docs html

[testenv:docs-linkcheck]
allowlist_externals = make
deps = {[testenv:docs-build]deps}
commands =
make -C tests/docs clean
make -C tests/docs linkcheck