Skip to content

Conversation

eumiro
Copy link
Contributor

@eumiro eumiro commented Mar 12, 2025

As a beginner in rustworkx, when I followed the API docs, sometimes I was not quite sure whether the argument or the return value was the int node indices or the attached objects.

Unfortunately it looks like it is not possible to add Python type hints to the PyO3 signatures. Therefore I reviewed the src/graph.rs and added them wherever possible in the docstrings. I also tried to consolidate the description of the same parameters across the functions.

If this is a good way to go, I'll be happy to tackle the rest of the docstrings in the near future.

  • I ran rustfmt locally
  • I have added the tests to cover my changes.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.

@coveralls
Copy link

coveralls commented Mar 12, 2025

Pull Request Test Coverage Report for Build 13842244785

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

Totals Coverage Status
Change from base Build 13803380974: 0.0%
Covered Lines: 18425
Relevant Lines: 19331

💛 - Coveralls

@IvanIsCoding
Copy link
Collaborator

Firstly, thanks for your second contribution! This is higly appreciated. I think for PyGraph specially since it was the very first code written for rustworkx, it might have been overlooked.

Moreover, when we initially wrote our documentation Sphinx did not support type annotations. I need to get up to date on sphinx-doc/sphinx#7630 and Sphinx support.

When writing the docs, take a look at https://github.com/Qiskit/rustworkx/blob/main/rustworkx/rustworkx.pyi. The docstrings should agree with the .pyi files as that is what tools like mypy and VSCode will look at. This is also what I will use to review.

@eumiro
Copy link
Contributor Author

eumiro commented Mar 13, 2025

Thanks, @IvanIsCoding , I hope I could update everything from your review.

Copy link
Collaborator

@IvanIsCoding IvanIsCoding left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fantastic! Thank you.

@IvanIsCoding IvanIsCoding added this pull request to the merge queue Mar 13, 2025
Merged via the queue into Qiskit:main with commit 4738ef6 Mar 13, 2025
31 checks passed
@eumiro eumiro deleted the consolidate-docstrings branch March 14, 2025 17:40
SILIZ4 pushed a commit to SILIZ4/rustworkx that referenced this pull request Jul 4, 2025
* Consolidate Python docstrings in graph.rs

* Updates from the first review
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.

3 participants