Skip to content

Commit 0472d85

Browse files
jacalataclaude
andcommitted
docs: generate full API reference with sphinx-autoapi
The previous conf.py used a single `.. automodule:: tableauserverclient` which only covers names re-exported from `tableauserverclient/__init__.py`. That silently drops every endpoint class and every root helper module -- Favorites, VirtualConnections, config, datetime_helpers, filesys_helpers, namespace, exponential_backoff -- and readers running into missing methods had no way to find the underlying signatures. Wire in sphinx-autoapi with autoapi_dirs pointing at the source tree. The generator walks every module (including private endpoints) and produces a reference page per module under docs/reference/. `autoapi_root` and the corresponding .gitignore entry are kept in sync. Other tweaks: - Replace the empty toctree in docs/index.rst with a hidden one so autoapi's `autoapi_add_toctree_entry` has a node to append to (without an existing toctree it is a no-op and Furo's sidebar comes out empty). - Add `python -m pip install --upgrade pip` to the docs workflow to avoid the resolver-warnings that older pips emit on modern extras. Docstring warnings surfaced by autoapi are not addressed here; a follow-up PR will fix the RST-vs-Google mismatches introduced by the recent Favorites, VirtualConnections, and root-helper docstring passes. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 939ad9d commit 0472d85

5 files changed

Lines changed: 44 additions & 8 deletions

File tree

.github/workflows/docs.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ jobs:
2525
python-version: "3.13"
2626

2727
- name: Install docs dependencies
28-
run: pip install -e ".[docs]"
28+
run: |
29+
python -m pip install --upgrade pip
30+
pip install -e ".[docs]"
2931
3032
- name: Build Sphinx docs
3133
run: sphinx-build -b html docs sphinx_build

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@ instance/
6666

6767
# Sphinx documentation
6868
docs/_build/
69+
# sphinx-autoapi generated tree; path matches `autoapi_root` in docs/conf.py.
70+
# Rebuilt on every sphinx-build, must never be committed. Keep in sync if
71+
# autoapi_root is renamed.
72+
docs/reference/
6973

7074
# PyBuilder
7175
target/

docs/conf.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,31 @@
3939
"sphinx.ext.autosummary",
4040
"sphinx.ext.intersphinx",
4141
"sphinx.ext.napoleon",
42+
"autoapi.extension",
4243
]
4344

45+
# -- sphinx-autoapi configuration --------------------------------------------
46+
# Walk the tableauserverclient source tree and generate reference docs for
47+
# every module. A top-level `.. automodule::` would only cover names
48+
# re-exported from `tableauserverclient/__init__.py`, which misses all the
49+
# endpoint classes (Favorites, Workbooks, VirtualConnections, ...) and the
50+
# root helper modules (config, filesys_helpers, namespace, datetime_helpers,
51+
# exponential_backoff). autoapi picks those up.
52+
#
53+
# NOTE: `autoapi_root` also drives the generated tree's on-disk location.
54+
# It is referenced from `.gitignore` (docs/reference/); keep them in sync.
55+
autoapi_dirs = ["../tableauserverclient"]
56+
autoapi_root = "reference"
57+
autoapi_options = [
58+
"members",
59+
"undoc-members",
60+
"show-inheritance",
61+
"show-module-summary",
62+
]
63+
autoapi_ignore = ["*/bin/*", "*/_version.py"]
64+
autoapi_add_toctree_entry = True
65+
autoapi_keep_files = False
66+
4467
intersphinx_mapping = {
4568
"rtd": ("https://docs.readthedocs.io/en/stable/", None),
4669
"python": ("https://docs.python.org/3/", None),

docs/index.rst

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
11
tableauserverclient
22
===================
33

4-
.. toctree::
5-
:maxdepth: 2
6-
:caption: Contents:
4+
Python client library for the Tableau Server REST API.
5+
6+
The full API reference is generated automatically from the source tree by
7+
`sphinx-autoapi`_ and lives under :doc:`reference/tableauserverclient/index`.
8+
9+
.. _sphinx-autoapi: https://sphinx-autoapi.readthedocs.io/
710

8-
.. automodule:: tableauserverclient
9-
:members:
10-
:imported-members:
11+
.. Empty hidden toctree gives sphinx-autoapi a node to append its generated
12+
reference/ tree onto. Without an existing toctree in this file autoapi's
13+
``autoapi_add_toctree_entry`` is a no-op and Furo's sidebar navigation
14+
comes out empty. See sphinx-autoapi extension.py doctree_read handler.
15+
16+
.. toctree::
17+
:hidden:

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ repository = "https://github.com/tableau/server-client-python"
3535
[project.optional-dependencies]
3636
test = ["black==26.5.1", "build", "mypy==2.3.0", "pytest>=7.0", "pytest-cov", "pytest-subtests",
3737
"pytest-xdist", "requests-mock>=1.0,<2.0", "types-requests>=2.32.4.20250913"]
38-
docs = ["sphinx>=7,<9", "furo>=2024,<2027", "tomli; python_version < '3.11'"]
38+
docs = ["sphinx>=7,<9", "furo>=2024,<2027", "sphinx-autoapi>=3.3,<4", "tomli; python_version < '3.11'"]
3939

4040
[tool.setuptools.package-data]
4141
# Only include data for tableauserverclient, not for samples, test, docs

0 commit comments

Comments
 (0)