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

Weird NoiseLearner.run parameter type in docs #1877

Closed
jyu00 opened this issue Aug 19, 2024 · 2 comments · Fixed by #2052
Closed

Weird NoiseLearner.run parameter type in docs #1877

jyu00 opened this issue Aug 19, 2024 · 2 comments · Fixed by #2052
Assignees
Labels
bug Something isn't working documentation Improvements or additions to documentation
Milestone

Comments

@jyu00
Copy link
Collaborator

jyu00 commented Aug 19, 2024

Describe the bug

The NoiseLearner.run API page describes the circuits input type as

image

That's not exactly digestible.

Steps to reproduce

Expected behavior

Suggested solutions

Additional Information

@Eric-Arellano Maybe this is trying to reference EstimatorPubLike in a weird way? Estimator's API doc doesn't have this issue though.

cc @SamFerracin

  • qiskit-ibm-runtime version:
  • Python version:
  • Operating system:
@jyu00 jyu00 added the bug Something isn't working label Aug 19, 2024
@Eric-Arellano
Copy link
Collaborator

Maybe this is trying to reference EstimatorPubLike in a weird way? Estimator's API doc doesn't have this issue though.

Yes, that is what's going on. I'm not sure why Sphinx is expanding inlining EstimatorPubLike in https://docs.quantum.ibm.com/api/qiskit-ibm-runtime/qiskit_ibm_runtime.noise_learner.NoiseLearner#run but not https://docs.quantum.ibm.com/api/qiskit-ibm-runtime/qiskit_ibm_runtime.EstimatorV2#run 🤔

@Eric-Arellano Eric-Arellano added the documentation Improvements or additions to documentation label Nov 19, 2024
@Eric-Arellano Eric-Arellano self-assigned this Nov 19, 2024
@Eric-Arellano Eric-Arellano moved this to Todo in Docs Planning Nov 19, 2024
@Eric-Arellano Eric-Arellano moved this from Todo to In Progress in Docs Planning Nov 19, 2024
@Eric-Arellano
Copy link
Collaborator

I have a fix for this in the works 🚀 Working on this discovered another issue that I'm working on and blocks this. I hope to have it up tomorrow.

@kt474 kt474 added this to the 0.34.0 milestone Nov 25, 2024
@javabster javabster moved this from In Progress to In Review in Docs Planning Nov 25, 2024
@github-project-automation github-project-automation bot moved this from In Review to Done in Docs Planning Nov 25, 2024
Eric-Arellano added a commit to Eric-Arellano/qiskit-ibm-runtime that referenced this issue 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 issue 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`.
```
@javabster javabster removed this from Docs Planning Feb 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants