From 01afeddd51c34c8f482a43b2a75745fbab024760 Mon Sep 17 00:00:00 2001 From: Vaibhav Naik Date: Sun, 20 Sep 2026 11:22:10 -0700 Subject: [PATCH] docs: link reference API docs back to GitHub source Replace sphinx.ext.viewcode with sphinx.ext.linkcode and a custom linkcode_resolve() in docs/conf.py. viewcode only rendered a local copy of the source inside the docs site; linkcode points each object's "[source]" link directly at its file/line on github.com/apache/hamilton, pinned to the release tag when building from a tag and to the exact commit otherwise so line numbers stay in sync. Verified with a local sphinx-build: the StrictIndexTypePandasDataFrameResult entry cited in the issue now links to github.com/apache/hamilton/blob//hamilton/base.py#L306, the correct line. Fixes #572 --- docs/conf.py | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 55 insertions(+), 1 deletion(-) diff --git a/docs/conf.py b/docs/conf.py index dded9aff4..09f035468 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -15,6 +15,7 @@ # specific language governing permissions and limitations # under the License. +import inspect import os import re import subprocess @@ -22,6 +23,7 @@ # required to get reference documentation to be built sys.path.insert(0, os.path.abspath("..")) +REPO_ROOT = os.path.abspath("..") apache_footer = """