drgn/docs/conf.py
Omar Sandoval 80c9fb35ff Add type hint stubs and generate documentation from them
I've been wanting to add type hints for the _drgn C extension for
awhile. The main blocker was that there is a large overlap between the
documentation (in docs/api_reference.rst) and the stub file, and I
really didn't want to duplicate the information. Therefore, it was a
requirement that the the documentation could be generated from the stub
file, or vice versa. Unfortunately, none of the existing tools that I
could find supported this very well. So, I bit the bullet and wrote my
own Sphinx extension that uses the stub file as the source of truth (and
subsumes my old autopackage extension and gen_docstrings script).

The stub file is probably incomplete/inaccurate in places, but this
should be a good starting point to improve on.

Closes #22.
2020-02-25 13:39:06 -08:00

51 lines
1023 B
Python

import os.path
import sys
sys.path.append(os.path.abspath(".."))
sys.path.append(os.path.abspath("exts"))
master_doc = "index"
extensions = [
"drgndoc.ext",
"setuptools_config",
"sphinx.ext.extlinks",
"sphinx.ext.intersphinx",
"sphinx.ext.viewcode",
]
drgndoc_paths = ["../drgn", "../_drgn.pyi"]
drgndoc_substitutions = [
(r"^_drgn\b", "drgn"),
]
extlinks = {
"linux": (
"https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/%s",
"",
),
}
intersphinx_mapping = {
"python": ("https://docs.python.org/3", None),
}
manpages_url = "http://man7.org/linux/man-pages/man{section}/{page}.{section}.html"
html_static_path = ["_static"]
html_theme = "alabaster"
html_theme_options = {
"description": "Debugger-as-a-library",
"logo": "logo.png",
"logo_name": True,
"logo_text_align": "center",
"github_user": "osandov",
"github_repo": "drgn",
"github_button": True,
"github_type": "star",
}
html_favicon = "favicon.ico"