Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

Use sphinx.ext.linkcode for more precise source code links #821

Merged
merged 6 commits into from
Feb 28, 2024

Conversation

melechlapson
Copy link
Contributor

@melechlapson melechlapson commented Feb 27, 2024

Summary

This addresses Qiskit/documentation#517 by switching out the sphinx.ext.viewcode for the sphinx.ext.linkcode extension which allows our GitHub links in the documentation to be linked to the specific lines of code, not just the file. This was tested successfully in Qiskit/qiskit_sphinx_theme#589 and in the qiskit repo in Qiskit/qiskit#11851 as well as the runtime repo in Qiskit/qiskit-ibm-runtime#1431 and now we want to implement it in the provider repo.

The API generation script at Qiskit/documentation already knows how to handle sphinx.ext.linkcode.

Example links from this PR:

@melechlapson melechlapson changed the title switched from using sphinx-ext-viewcode to sphinx-ext-linkcode Use sphinx.ext.linkcode for more precise source code links in provider repo Feb 27, 2024
@melechlapson melechlapson changed the title Use sphinx.ext.linkcode for more precise source code links in provider repo Use sphinx.ext.linkcode for more precise source code links in the provider repo Feb 27, 2024
@coveralls
Copy link

coveralls commented Feb 27, 2024

Pull Request Test Coverage Report for Build 8073974612

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 43.35%

Totals Coverage Status
Change from base Build 8072871912: 0.0%
Covered Lines: 2940
Relevant Lines: 6782

💛 - Coveralls

@Eric-Arellano Eric-Arellano changed the title Use sphinx.ext.linkcode for more precise source code links in the provider repo Use sphinx.ext.linkcode for more precise source code links Feb 27, 2024
docs/conf.py Outdated Show resolved Hide resolved
@Eric-Arellano Eric-Arellano marked this pull request as ready for review February 28, 2024 14:46
@kt474 kt474 merged commit 851a01c into Qiskit:main Feb 28, 2024
19 checks passed
Eric-Arellano added a commit to Eric-Arellano/qiskit-ibm-provider that referenced this pull request Feb 28, 2024
* switched from using sphinx-ext-viewcode to sphinx-ext-linkcode

* updated tox.ini

* removed leftover code from azure

* switched dashes to underscores

* Try fix for methods inherited by Qiskit

---------

Co-authored-by: Eric Arellano <14852634+Eric-Arellano@users.noreply.github.com>
kt474 pushed a commit that referenced this pull request Feb 28, 2024
* switched from using sphinx-ext-viewcode to sphinx-ext-linkcode

* updated tox.ini

* removed leftover code from azure

* switched dashes to underscores

* Try fix for methods inherited by Qiskit

---------

Co-authored-by: melechlapson <melechlapson@yahoo.com>
Eric-Arellano added a commit that referenced this pull request Feb 28, 2024
Fixes #821. 

I made a divergence from our testing in qiskit-sphinx-theme to make the INI file more readable, and I didn't properly test it. My bad!

This bug meant that we always used `main` as the branch name. I tested this out locally and it works now:

```
GITHUB_REF_NAME="pull" GITHUB_BASE_REF="upstream" tox -e docs
...
    raise ValueError(GITHUB_BRANCH)
ValueError: upstream
```
Eric-Arellano added a commit to Eric-Arellano/qiskit-ibm-provider that referenced this pull request Feb 28, 2024
Fixes Qiskit#821. 

I made a divergence from our testing in qiskit-sphinx-theme to make the INI file more readable, and I didn't properly test it. My bad!

This bug meant that we always used `main` as the branch name. I tested this out locally and it works now:

```
GITHUB_REF_NAME="pull" GITHUB_BASE_REF="upstream" tox -e docs
...
    raise ValueError(GITHUB_BRANCH)
ValueError: upstream
```
kt474 pushed a commit that referenced this pull request Feb 28, 2024
Fixes #821. 

I made a divergence from our testing in qiskit-sphinx-theme to make the INI file more readable, and I didn't properly test it. My bad!

This bug meant that we always used `main` as the branch name. I tested this out locally and it works now:

```
GITHUB_REF_NAME="pull" GITHUB_BASE_REF="upstream" tox -e docs
...
    raise ValueError(GITHUB_BRANCH)
ValueError: upstream
```
Eric-Arellano pushed a commit that referenced this pull request Apr 18, 2024
### Summary
A follow-up from Qiskit/qiskit-ibm-runtime#1439. In recent PRs including my PR #821, the CI has been throwing several errors due to old versions of actions that are using node12 or node16 instead of node20. I updated the actions to use the latest versions which should eliminate the CI warnings.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants