-
Notifications
You must be signed in to change notification settings - Fork 445
docs: set up Sphinx + ReadTheDocs pipeline for auto-generated API reference #1832
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
jacalata
wants to merge
9
commits into
development
Choose a base branch
from
jac/docs-sphinx-readthedocs
base: development
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
db6b9a4
Create .readthedocs.yaml for documentation setup
jacalata b021986
Create Sphinx configuration file for documentation
jacalata a195f86
Load project details from pyproject.toml
jacalata ed8b75f
docs: set up Sphinx with working ReadTheDocs config
jacalata 8cebc5e
change theme
jacalata 3cf02f6
ci: add workflow to build Sphinx docs and PR to gh-pages
jacalata f0f4f2f
Merge origin/development into jac/docs-sphinx-readthedocs
jacalata 939ad9d
docs: address adversarial review findings on Sphinx/RTD pipeline
jacalata 0472d85
docs: generate full API reference with sphinx-autoapi
jacalata File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| name: Build and publish docs | ||
|
|
||
| on: | ||
| push: | ||
| branches: [master] | ||
|
|
||
| permissions: | ||
| contents: write | ||
| pull-requests: write | ||
|
|
||
| # Serialize docs regen runs so a new push doesn't rewrite the docs-update | ||
| # branch mid-flight for a prior run that hasn't finished opening its PR. | ||
| concurrency: | ||
| group: docs-publish | ||
| cancel-in-progress: false | ||
|
|
||
| jobs: | ||
| build-and-pr: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: "3.13" | ||
|
|
||
| - name: Install docs dependencies | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| pip install -e ".[docs]" | ||
|
|
||
| - name: Build Sphinx docs | ||
| run: sphinx-build -b html docs sphinx_build | ||
|
|
||
| - name: Checkout gh-pages | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| ref: gh-pages | ||
| path: gh-pages | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Copy Sphinx output into gh-pages/sphinx | ||
| run: | | ||
| rm -rf gh-pages/sphinx | ||
| cp -r sphinx_build gh-pages/sphinx | ||
|
|
||
| # delete-branch: true removes the docs-update branch after its PR is | ||
| # merged/closed. Without it, an unmerged prior PR's branch gets | ||
| # force-updated on the next run and any review comments on it are | ||
| # stranded. | ||
| - name: Create PR to gh-pages | ||
| uses: peter-evans/create-pull-request@v6 | ||
| with: | ||
| path: gh-pages | ||
| branch: docs-update | ||
| base: gh-pages | ||
| delete-branch: true | ||
| title: "docs: update generated API reference" | ||
| body: "Automated update of Sphinx-generated API reference from master." | ||
| commit-message: "docs: regenerate Sphinx API reference" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| # Read the Docs configuration file | ||
| # See https://docs.readthedocs.io/en/stable/config-file/v2.html for details | ||
|
|
||
| # Required | ||
| version: 2 | ||
|
|
||
| # Set the OS, Python version, and other tools you might need | ||
| build: | ||
| os: ubuntu-24.04 | ||
| tools: | ||
| python: "3.13" | ||
|
|
||
| # Build documentation in the "docs/" directory with Sphinx | ||
| sphinx: | ||
| configuration: docs/conf.py | ||
|
|
||
| # Optionally, but recommended, | ||
| # declare the Python requirements required to build your documentation | ||
| # See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html | ||
| python: | ||
| install: | ||
| - method: pip | ||
| path: . | ||
| extra_requirements: | ||
| - docs | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,89 @@ | ||
| # Configuration file for the Sphinx documentation builder. | ||
| # | ||
| # This file only contains a selection of the most common options. For a full | ||
| # list see the documentation: | ||
| # https://www.sphinx-doc.org/en/master/usage/configuration.html | ||
|
|
||
|
|
||
| # -- Project information ----------------------------------------------------- | ||
| # Source - https://stackoverflow.com/a/75396624 | ||
| # Posted by Jan, modified by community. See post 'Timeline' for change history | ||
| # Retrieved 2026-06-19, License - CC BY-SA 4.0 | ||
|
|
||
| # conf.py | ||
|
|
||
| try: | ||
| import tomllib | ||
| except ImportError: | ||
| import tomli as tomllib | ||
|
|
||
| from pathlib import Path | ||
| import importlib.metadata | ||
|
|
||
| with open(Path(__file__).parent.parent / "pyproject.toml", "rb") as f: | ||
| toml = tomllib.load(f) | ||
|
|
||
| # -- Project information ----------------------------------------------------- | ||
|
|
||
| project = toml["project"]["name"] | ||
| release = importlib.metadata.version(project) | ||
| version = ".".join(release.split(".")[:2]) | ||
|
|
||
| # -- General configuration --------------------------------------------------- | ||
| # -- General configuration | ||
|
|
||
| extensions = [ | ||
| "sphinx.ext.duration", | ||
| "sphinx.ext.doctest", | ||
| "sphinx.ext.autodoc", | ||
| "sphinx.ext.autosummary", | ||
| "sphinx.ext.intersphinx", | ||
| "sphinx.ext.napoleon", | ||
| "autoapi.extension", | ||
| ] | ||
|
|
||
| # -- sphinx-autoapi configuration -------------------------------------------- | ||
| # Walk the tableauserverclient source tree and generate reference docs for | ||
| # every module. A top-level `.. automodule::` would only cover names | ||
| # re-exported from `tableauserverclient/__init__.py`, which misses all the | ||
| # endpoint classes (Favorites, Workbooks, VirtualConnections, ...) and the | ||
| # root helper modules (config, filesys_helpers, namespace, datetime_helpers, | ||
| # exponential_backoff). autoapi picks those up. | ||
| # | ||
| # NOTE: `autoapi_root` also drives the generated tree's on-disk location. | ||
| # It is referenced from `.gitignore` (docs/reference/); keep them in sync. | ||
| autoapi_dirs = ["../tableauserverclient"] | ||
| autoapi_root = "reference" | ||
| autoapi_options = [ | ||
| "members", | ||
| "undoc-members", | ||
| "show-inheritance", | ||
| "show-module-summary", | ||
| ] | ||
| autoapi_ignore = ["*/bin/*", "*/_version.py"] | ||
| autoapi_add_toctree_entry = True | ||
| autoapi_keep_files = False | ||
|
|
||
| intersphinx_mapping = { | ||
| "rtd": ("https://docs.readthedocs.io/en/stable/", None), | ||
| "python": ("https://docs.python.org/3/", None), | ||
| "sphinx": ("https://www.sphinx-doc.org/en/master/", None), | ||
| } | ||
| intersphinx_disabled_domains = ["std"] | ||
|
|
||
| # List of patterns, relative to source directory, that match files and | ||
| # directories to ignore when looking for source files. | ||
| # This pattern also affects html_static_path and html_extra_path. | ||
| exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"] | ||
|
|
||
| # -- Options for HTML output ------------------------------------------------- | ||
|
|
||
| # The theme to use for HTML and HTML Help pages. See the documentation for | ||
| # a list of builtin themes. | ||
| # | ||
| html_theme = "furo" | ||
|
|
||
| # Add any paths that contain custom static files (such as style sheets) here, | ||
| # relative to this directory. They are copied after the builtin static files, | ||
| # so a file named "default.css" will overwrite the builtin "default.css". | ||
| html_static_path = [] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| tableauserverclient | ||
| =================== | ||
|
|
||
| Python client library for the Tableau Server REST API. | ||
|
|
||
| The full API reference is generated automatically from the source tree by | ||
| `sphinx-autoapi`_ and lives under :doc:`reference/tableauserverclient/index`. | ||
|
|
||
| .. _sphinx-autoapi: https://sphinx-autoapi.readthedocs.io/ | ||
|
|
||
| .. Empty hidden toctree gives sphinx-autoapi a node to append its generated | ||
| reference/ tree onto. Without an existing toctree in this file autoapi's | ||
| ``autoapi_add_toctree_entry`` is a no-op and Furo's sidebar navigation | ||
| comes out empty. See sphinx-autoapi extension.py doctree_read handler. | ||
|
|
||
| .. toctree:: | ||
| :hidden: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.