|
1 | | -# Configuration file for the Sphinx documentation builder. |
2 | | -# |
3 | | -# This file only contains a selection of the most common options. For a full |
4 | | -# list see the documentation: |
5 | | -# https://www.sphinx-doc.org/en/master/usage/configuration.html |
6 | | - |
7 | | -# -- Path setup -------------------------------------------------------------- |
8 | | - |
9 | | -# If extensions (or modules to document with autodoc) are in another directory, |
10 | | -# add these directories to sys.path here. If the directory is relative to the |
11 | | -# documentation root, use os.path.abspath to make it absolute, like shown here. |
12 | | -# |
13 | 1 | import os |
14 | 2 | import sys |
15 | 3 |
|
16 | 4 | sys.path.insert(0, os.path.abspath("..")) |
17 | 5 |
|
18 | | - |
19 | | -# -- Project information ----------------------------------------------------- |
20 | | - |
21 | 6 | project = "OpenAEV client for Python" |
22 | 7 | copyright = "2024, Filigran" |
23 | 8 | author = "OpenAEV Project" |
24 | | - |
25 | | -# The full version, including alpha/beta/rc tags |
26 | 9 | release = "1.10.1" |
27 | 10 |
|
28 | 11 | master_doc = "index" |
29 | | - |
30 | | -autoapi_modules = {"pyoaev": {"prune": True}} |
31 | | - |
32 | 12 | pygments_style = "sphinx" |
33 | 13 |
|
34 | | -# -- General configuration --------------------------------------------------- |
35 | | - |
36 | | -# Add any Sphinx extension module names here, as strings. They can be |
37 | | -# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom |
38 | | -# ones. |
39 | 14 | extensions = [ |
40 | 15 | "sphinx.ext.autodoc", |
41 | 16 | "sphinx.ext.inheritance_diagram", |
42 | | - "autoapi.sphinx", |
| 17 | + "autoapi.extension", |
43 | 18 | "sphinx_autodoc_typehints", |
44 | 19 | ] |
45 | 20 |
|
46 | | -# Add any paths that contain templates here, relative to this directory. |
47 | | -templates_path = ["_templates"] |
| 21 | +autoapi_dirs = ["../pyoaev"] |
| 22 | +autoapi_options = [ |
| 23 | + "members", |
| 24 | + "undoc-members", |
| 25 | + "private-members", |
| 26 | + "show-inheritance", |
| 27 | +] |
48 | 28 |
|
49 | | -# List of patterns, relative to source directory, that match files and |
50 | | -# directories to ignore when looking for source files. |
51 | | -# This pattern also affects html_static_path and html_extra_path. |
52 | | -exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"] |
| 29 | +autodoc_inherit_docstrings = False |
53 | 30 |
|
| 31 | +# Inherited docstrings from stdlib base classes are noisy — suppress them |
| 32 | +_INHERITED_DOCSTRING_MARKERS = [ |
| 33 | + "Create a collection of name/value pairs.", # enum.Enum |
| 34 | + "str(object='') -> str", # str |
| 35 | +] |
54 | 36 |
|
55 | | -# -- Options for HTML output ------------------------------------------------- |
56 | 37 |
|
57 | | -# The theme to use for HTML and HTML Help pages. See the documentation for |
58 | | -# a list of builtin themes. |
59 | | -# |
60 | | -html_theme = "sphinx_rtd_theme" |
| 38 | +def _suppress_inherited_docstring(app, what, name, obj, options, lines): |
| 39 | + """Remove inherited stdlib docstrings from generated API docs.""" |
| 40 | + if what == "class" and lines: |
| 41 | + joined = "\n".join(lines) |
| 42 | + if any(marker in joined for marker in _INHERITED_DOCSTRING_MARKERS): |
| 43 | + lines.clear() |
| 44 | + |
| 45 | + |
| 46 | +def setup(app): |
| 47 | + app.connect("autodoc-process-docstring", _suppress_inherited_docstring) |
61 | 48 |
|
62 | | -# Add any paths that contain custom static files (such as style sheets) here, |
63 | | -# relative to this directory. They are copied after the builtin static files, |
64 | | -# so a file named "default.css" will overwrite the builtin "default.css". |
| 49 | + |
| 50 | +templates_path = ["_templates"] |
| 51 | +exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"] |
| 52 | + |
| 53 | +html_theme = "sphinx_rtd_theme" |
65 | 54 | html_static_path = ["_static"] |
0 commit comments