-
Notifications
You must be signed in to change notification settings - Fork 159
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
Fix type hints in docs for PUBs and improve Sphinx config #2052
Merged
Conversation
This file contains 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
You can see a preview of the diff caused by this PR at https://github.com/Qiskit/documentation/pull/2343/files |
kt474
approved these changes
Nov 25, 2024
Eric-Arellano
added a commit
to Eric-Arellano/qiskit-ibm-runtime
that referenced
this pull request
Nov 25, 2024
Closes Qiskit#1877. We now use `EstimatorPubLike` and `SamplerPubLike` for the type hints, rather than Sphinx fully expanding the types into extremely long values shown in Qiskit#1877. To fix the type hints, we have to stop using `sphinx-autodoc-typehints` and instead use autodoc's builtin support for type hints. I didn't realize we were still using `sphinx-autodoc-typehints` - the other Qiskit projects migrated off a while ago. This PR also makes some other improvements to align with changes we made in Qiskit Addons & qiskit-ibm-transpiler: * always show inheritance in class pages for the base class * index page should show the PyPI package name in code syntax * don't show signatures in `autosummary` tables, since they're noisy * show type hints for parameters that don't have docstring ## Introduces a regression: type hints for properties Unfortunately, switching off of `sphinx-autodoc-typehints` results in Qiskit/documentation#2346. This is a quirk of autosummary that we cannot easily fix. We have a plan to fix it, although realistically won't get to it until Q1 and possibly Q2. In the meantime, consider repeating some of the type information in the docstring. For example, in ``` <Attribute id="qiskit_ibm_runtime.EstimatorV2.mode"> Return the execution mode used by this primitive. ``` You could rewrite to say ``` <Attribute id="qiskit_ibm_runtime.EstimatorV2.mode"> Return the execution mode used by this primitive, either :class:~`.Session` or ~:class:~`.Batch`. ```
kt474
pushed a commit
that referenced
this pull request
Nov 25, 2024
) Closes #1877. We now use `EstimatorPubLike` and `SamplerPubLike` for the type hints, rather than Sphinx fully expanding the types into extremely long values shown in #1877. To fix the type hints, we have to stop using `sphinx-autodoc-typehints` and instead use autodoc's builtin support for type hints. I didn't realize we were still using `sphinx-autodoc-typehints` - the other Qiskit projects migrated off a while ago. This PR also makes some other improvements to align with changes we made in Qiskit Addons & qiskit-ibm-transpiler: * always show inheritance in class pages for the base class * index page should show the PyPI package name in code syntax * don't show signatures in `autosummary` tables, since they're noisy * show type hints for parameters that don't have docstring ## Introduces a regression: type hints for properties Unfortunately, switching off of `sphinx-autodoc-typehints` results in Qiskit/documentation#2346. This is a quirk of autosummary that we cannot easily fix. We have a plan to fix it, although realistically won't get to it until Q1 and possibly Q2. In the meantime, consider repeating some of the type information in the docstring. For example, in ``` <Attribute id="qiskit_ibm_runtime.EstimatorV2.mode"> Return the execution mode used by this primitive. ``` You could rewrite to say ``` <Attribute id="qiskit_ibm_runtime.EstimatorV2.mode"> Return the execution mode used by this primitive, either :class:~`.Session` or ~:class:~`.Batch`. ```
github-merge-queue bot
pushed a commit
to Qiskit/documentation
that referenced
this pull request
Nov 25, 2024
Applies the changes from Qiskit/qiskit-ibm-runtime#2052.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes #1877. We now use
EstimatorPubLike
andSamplerPubLike
for the type hints, rather than Sphinx fully expanding the types into extremely long values shown in #1877.To fix the type hints, we have to stop using
sphinx-autodoc-typehints
and instead use autodoc's builtin support for type hints. I didn't realize we were still usingsphinx-autodoc-typehints
- the other Qiskit projects migrated off a while ago.This PR also makes some other improvements to align with changes we made in Qiskit Addons & qiskit-ibm-transpiler:
autosummary
tables, since they're noisyIntroduces a regression: type hints for properties
Unfortunately, switching off of
sphinx-autodoc-typehints
results in Qiskit/documentation#2346. This is a quirk of autosummary that we cannot easily fix. We have a plan to fix it, although realistically won't get to it until Q1 and possibly Q2.In the meantime, consider repeating some of the type information in the docstring. For example, in
You could rewrite to say