Fix type hints in docs for PUBs and improve Sphinx config (Cherry-pick of #2052) #2055
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