Skip to content
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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reorganize API docs (backport #24) #29

Merged
merged 3 commits into from
Oct 28, 2024

Conversation

mergify[bot]
Copy link

@mergify mergify bot commented Oct 28, 2024

Changes

Adds index page

This page is important so that docs.quantum.ibm.com/api/qiskit-addon-obp does not 404. It should simply be a flat list of every documented module.

Flattens submodules

We've gotten prior user complaints that they don't like when docs have a lot of nesting. So, docs.quantum.ibm.com expects all modules to be flattened to the same level in the left ToC. This means that users access submodules via the left ToC, rather than through the parent module's page.

Due to this change, we delete qiskit_addon_obp.utils because it does not actually have any importable interfaces.

If the module list ever gets too big, the qiskit/documentation repository has a mechanism to let you group modules into parent folders (see https://docs.quantum.ibm.com/api/qiskit).

Sets module metadata & moves structural directives to RST

The script in qiskit/documentation expects you to set (:mod:`qiskit_addon_obp`) at the top of every module page. We need this to extract metadata, which we use to set up the left ToC and <head> metadata for the page.

We also now set all the .. autodoc directives like .. autosummary in RST. Sphinx doesn't mix well when you have some structural elements like headings in RST and some in Python, so it's important to be consistent with where those structural elements go. Putting it in RST is more conventional, and it avoids us having to disable three Ruff lint rules. For modules, most the docs should be in the RST file other than a one-sentence summary of the module.

Inlines functions and some classes

We've gotten prior user complaints that they don't like when you have to click to a bunch of subpages to see individual functions and classes. So, we've generally adopted the approach of inlining functions and smaller classes. Larger classes and functions can still live on dedicated pages.

The right page ToC makes it so that users can still jump around the page.

This change is subjective. Feel free to push back if you think any particular interface should be a dedicated page!

We set up client-redirects using sphinx-reredirects to avoid 404s. We used this extension well with Qiskit SDK.

Results

docs.quantum.ibm.com Screenshot 2024-10-22 at 3 22 32 PM
GitHub Pages Screenshot 2024-10-22 at 3 31 20 PM Screenshot 2024-10-22 at 3 31 23 PM

This is an automatic backport of pull request #24 done by [Mergify](https://mergify.com).

## Changes

### Adds index page

This page is important so that `docs.quantum.ibm.com/api/qiskit-addon-obp` does not 404. It should simply be a flat list of every documented module.

### Flattens submodules

We've gotten prior user complaints that they don't like when docs have a lot of nesting. So, docs.quantum.ibm.com expects all modules to be flattened to the same level in the left ToC. This means that users access submodules via the left ToC, rather than through the parent module's page.

Due to this change, we delete qiskit_addon_obp.utils because it does not actually have any importable interfaces.

If the module list ever gets too big, the qiskit/documentation repository has a mechanism to let you group modules into parent folders (see https://docs.quantum.ibm.com/api/qiskit).

### Sets module metadata & moves structural directives to RST

The script in `qiskit/documentation` expects you to set ``(:mod:`qiskit_addon_obp`)`` at the top of every module page. We need this to extract metadata, which we use to set up the left ToC and `<head>` metadata for the page.

We also now set all the `.. autodoc` directives like `.. autosummary` in RST. Sphinx [doesn't mix well](https://stackoverflow.com/questions/62855567/headings-when-using-autodoc-in-sphinx) when you have some structural elements like headings in RST and some in Python, so it's important to be consistent with where those structural elements go. Putting it in RST is more conventional, and it avoids us having to disable three Ruff lint rules. For modules, most the docs should be in the RST file other than a one-sentence summary of the module.

### Inlines functions and some classes

We've gotten prior user complaints that they don't like when you have to click to a bunch of subpages to see individual functions and classes. So, we've generally adopted the approach of inlining functions and smaller classes. Larger classes and functions can still live on dedicated pages.

The right page ToC makes it so that users can still jump around the page.

This change is subjective. Feel free to push back if you think any particular interface should be a dedicated page!

We set up client-redirects using sphinx-reredirects to avoid 404s. We used this extension well with Qiskit SDK.

## Results

<details><summary>docs.quantum.ibm.com</summary>

<img width="976" alt="Screenshot 2024-10-22 at 3 22 32 PM" src="https://github.com/user-attachments/assets/33bc2458-397f-4541-a7ba-2655b32c8c80">
</details>

<details><summary>GitHub Pages</summary>

<img width="289" alt="Screenshot 2024-10-22 at 3 31 20 PM" src="https://github.com/user-attachments/assets/70bd5d2a-fd05-4fd8-ad0d-efed379688bf">
<img width="625" alt="Screenshot 2024-10-22 at 3 31 23 PM" src="https://github.com/user-attachments/assets/9de98b41-d0b0-44b9-bcce-dbb1844b1057">
</details>

(cherry picked from commit 9675e1b)

# Conflicts:
#	qiskit_addon_obp/utils/__init__.py
#	qiskit_addon_obp/utils/metadata.py
#	qiskit_addon_obp/utils/operations.py
#	qiskit_addon_obp/utils/simplify.py
#	qiskit_addon_obp/utils/truncating.py
#	qiskit_addon_obp/utils/visualization.py
@mergify mergify bot added the conflicts label Oct 28, 2024
Copy link
Author

mergify bot commented Oct 28, 2024

Cherry-pick of 9675e1b has failed:

On branch mergify/bp/stable/0.1/pr-24
Your branch is up to date with 'origin/stable/0.1'.

You are currently cherry-picking commit 9675e1b.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:
	new file:   docs/apidocs/index.rst
	modified:   docs/apidocs/qiskit_addon_obp.rst
	modified:   docs/apidocs/qiskit_addon_obp.utils.metadata.rst
	modified:   docs/apidocs/qiskit_addon_obp.utils.operations.rst
	deleted:    docs/apidocs/qiskit_addon_obp.utils.rst
	modified:   docs/apidocs/qiskit_addon_obp.utils.simplify.rst
	modified:   docs/apidocs/qiskit_addon_obp.utils.truncating.rst
	modified:   docs/apidocs/qiskit_addon_obp.utils.visualization.rst
	modified:   docs/conf.py
	modified:   docs/index.rst
	modified:   pyproject.toml
	modified:   qiskit_addon_obp/__init__.py

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   qiskit_addon_obp/utils/__init__.py
	both modified:   qiskit_addon_obp/utils/metadata.py
	both modified:   qiskit_addon_obp/utils/operations.py
	both modified:   qiskit_addon_obp/utils/simplify.py
	both modified:   qiskit_addon_obp/utils/truncating.py
	both modified:   qiskit_addon_obp/utils/visualization.py

To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally

@Eric-Arellano
Copy link
Collaborator

@Mergifyio rebase stable/0.1

Copy link
Author

mergify bot commented Oct 28, 2024

rebase stable/0.1

☑️ Nothing to do

  • -conflict [📌 rebase requirement]
  • -closed [📌 rebase requirement]
  • queue-position = -1 [📌 rebase requirement]
  • any of:
    • #commits-behind > 0 [📌 rebase requirement]
    • #commits > 1 [📌 rebase requirement]
    • -linear-history [📌 rebase requirement]

@coveralls
Copy link

Pull Request Test Coverage Report for Build 11558986174

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 100.0%

Totals Coverage Status
Change from base Build 11558796199: 0.0%
Covered Lines: 429
Relevant Lines: 429

💛 - Coveralls

@Eric-Arellano Eric-Arellano merged commit 472badc into stable/0.1 Oct 28, 2024
15 checks passed
@Eric-Arellano Eric-Arellano deleted the mergify/bp/stable/0.1/pr-24 branch October 28, 2024 17:14
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.

2 participants