From e7161f5fbea1ba8c5a8069bb28558da4e9623e87 Mon Sep 17 00:00:00 2001 From: Joe Gordon Date: Fri, 3 Feb 2023 08:50:27 -0800 Subject: Make sure __init__ functions are displayed in docs By default autodocs only show class docstrings and hide __init__ https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html#confval-autoclass_content https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html#confval-autodoc_default_options Make sure docstrings added to __init__ functions show up in the docs --- docs/conf.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/docs/conf.py b/docs/conf.py index c78990a..4b2f3d4 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -17,8 +17,8 @@ # documentation root, use os.path.abspath to make it absolute, like shown here. # import os -import sys import subprocess +import sys sys.path.insert(0, os.path.abspath("..")) @@ -355,6 +355,12 @@ texinfo_documents = [ intersphinx_mapping = {"https://docs.python.org/": None} +# autodoc include __init__ +autodoc_default_options = { + "special-members": "__init__", +} + + # Automate building apidoc when building with readthedocs apidoc_module_dir = os.path.join("..", "pymemcache") apidoc_output_dir = "apidoc" -- cgit v1.2.1