Skip to content

Add sphinx.ext.linkcode to link API docs directly to GitHub source - #1177

Closed
viknesh-ai wants to merge 1 commit into
stumpy-dev:mainfrom
viknesh-ai:feat/linkcode-source-links
Closed

Add sphinx.ext.linkcode to link API docs directly to GitHub source#1177
viknesh-ai wants to merge 1 commit into
stumpy-dev:mainfrom
viknesh-ai:feat/linkcode-source-links

Conversation

@viknesh-ai

@viknesh-ai viknesh-ai commented Aug 9, 2026

Copy link
Copy Markdown

Replaces sphinx.ext.viewcode (which copies source into the built docs) with sphinx.ext.linkcode, so each "[source]" link on readthedocs points straight to the corresponding line range on GitHub, following the same pattern used by numpy and pandas. Falls back to the main branch when stumpy.version isn't a resolvable release version (e.g. editable installs).

Fixes #1081

Pull Request Checklist

Below is a simple checklist but please do not hesitate to ask for assistance!

  • Read our Contributing Guide
  • Referenced a Github issue (or create one if one doesn't already exist)
  • Read and reviewed all of the comments in the Github issue that you've referenced (along with cross-referenced issues/pull requests) to ensure that the issue still requires a pull request
  • Checked that the issue has not already been assigned to anybody else or is already being addressed in another pull request
  • Left a meaningful comment on the original Github issue to discuss the detailed approach for your contribution and received confirmation from the maintainers before proceeding with this pull request
  • Forked, cloned, and checked out the newest version of the code
  • Created a new branch
  • Made necessary code changes
  • Installed black (i.e., python -m pip install black or conda install -c conda-forge black)
  • Installed flake8 (i.e., python -m pip install flake8 or conda install -c conda-forge flake8)
  • Installed pytest-cov (i.e., python -m pip install pytest-cov or conda install -c conda-forge pytest-cov)
  • Ran black --exclude=".*\.ipynb" --extend-exclude=".venv" --diff ./ in the root stumpy directory
  • Ran flake8 --extend-exclude=.venv ./ in the root stumpy directory
  • Ran ./setup.sh dev && ./test.sh in the root stumpy directory and ensured that all tests are passing locally
  • Check this box if AI code assistance was used to generate 15%+ of the code in this pull request

Replaces sphinx.ext.viewcode (which copies source into the built docs)
with sphinx.ext.linkcode, so each "[source]" link on readthedocs points
straight to the corresponding line range on GitHub, following the same
pattern used by numpy and pandas. Falls back to the `main` branch when
stumpy.__version__ isn't a resolvable release version (e.g. editable
installs).

Fixes stumpy-dev#1081
@viknesh-ai
viknesh-ai requested a review from seanlaw as a code owner August 9, 2026 05:38
@gitnotebooks

gitnotebooks Bot commented Aug 9, 2026

Copy link
Copy Markdown

Review these changes at https://app.gitnotebooks.com/stumpy-dev/stumpy/pull/1177

@seanlaw seanlaw closed this Aug 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add [source] to RTD

2 participants