Closed Eric-Arellano closed 1 week ago
Yeah we should definitely fix this, the simple first step is to just add back the deleted docstrings from the python version to the pyo3 struct and methods.
However, the type hints are a bit more involved since there isn't a C api method of returning type hints from python. The best we can do is add a stub file like suggested in #12803 although it'd be incomplete to start as adding a complete one is a much larger undertaking (it's something we did in rustworkx and took the better part of a year given the api surface). I guess the easier first step would be to add them to the docstring so the info isn't lost even if means a regression from the mypy perspective.
The best we can do is add a stub file like suggested in https://github.com/Qiskit/qiskit/issues/12803 although it'd be incomplete to start as adding a complete one is a much larger undertaking (it's something we did in rustworkx and took the better part of a year given the api surface).
That's fine to be incomplete to start. I'd encourage taking that incremental approach. Type hints are helpful to developers in day-to-day because of the close IDE integrations, so it'd be a bummer to lose type information.
One benefit of adding the stub file—even if it's quite barren—is it makes it easier for all new oxidation to do the right thing. You can stop the problem from getting even bigger.
Fwiw, the original Python didn't have type hints either. What you can see is just part of the docstring.
When generating the 1.3 dev docs, I noticed this diff:
diff
```diff diff --git a/docs/api/qiskit/dev/qiskit.circuit.EquivalenceLibrary.mdx b/docs/api/qiskit/dev/qiskit.circuit.EquivalenceLibrary.mdx index 9d46ec616e..8cbc564e19 100644 --- a/docs/api/qiskit/dev/qiskit.circuit.EquivalenceLibrary.mdx +++ b/docs/api/qiskit/dev/qiskit.circuit.EquivalenceLibrary.mdx @@ -8,40 +8,22 @@ python_api_name: qiskit.circuit.EquivalenceLibrary # EquivalenceLibrary -Losing the GitHub source code link doesn't seem very feasible to fix because we populate it based on
inspect.getsourcefile
. Imo it's not that big of a deal because the class still has the link, and it might confuse users to point them to Rust code.The bigger concern is the type hints, parameters, and description.