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

Add annotations for type-specific rustworkx functions #963

Merged
merged 61 commits into from
Nov 22, 2023

Conversation

IvanIsCoding
Copy link
Collaborator

@IvanIsCoding IvanIsCoding commented Aug 7, 2023

Closes #960
Related to #352, follow up of #401

This adds type annotations to all type-specific rustworkx functions. It also re-exports all type-specific functions at the top-level, because it is unlikely that users will use rustworkx.rustworkx (it's a hidden implementation detail)

@coveralls
Copy link

coveralls commented Aug 7, 2023

Pull Request Test Coverage Report for Build 6962670551

  • 4 of 4 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 95.882%

Totals Coverage Status
Change from base Build 6952364260: 0.0%
Covered Lines: 15577
Relevant Lines: 16246

💛 - Coveralls

@IvanIsCoding IvanIsCoding marked this pull request as ready for review August 13, 2023 02:45
@IvanIsCoding IvanIsCoding changed the title [WIP] Add annotations for type-specific rustworkx functions Add annotations for type-specific rustworkx functions Aug 13, 2023
@IvanIsCoding IvanIsCoding added this to the 0.14.0 milestone Aug 13, 2023
@IvanIsCoding
Copy link
Collaborator Author

This is ready for review, I hope it makes it to 0.14

Copy link
Member

@mtreinish mtreinish left a comment

Choose a reason for hiding this comment

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

Overall this looks great, thanks for spending all the time to fix this. Just a couple of questions inline.

Copy link
Member

Choose a reason for hiding this comment

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

Do we have to worry that this adding a module that doesn't exist in the rustworkx package? Like we'll have type hints for rustworkx.cartesian_product.digraph_cartesian_product which isn't a valid path in rustworkx.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The linter complains but it’s a tradeoff. I created the files to organize our code like in Rust. But in practice our Rust just becomes one big file, while Python doesn’t. I could try adding underscores in the name of the files to prevent them from being imported following PEP-8 conventions

rustworkx/visit.pyi Show resolved Hide resolved
src/connectivity/mod.rs Show resolved Hide resolved
@mtreinish mtreinish added the automerge Queue a approved PR for merging label Nov 22, 2023
@mergify mergify bot merged commit f1d02e3 into Qiskit:main Nov 22, 2023
27 checks passed
@IvanIsCoding IvanIsCoding deleted the more-annotations branch January 28, 2024 01:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge Queue a approved PR for merging
Projects
None yet
Development

Successfully merging this pull request may close these issues.

mypy cannot find type-specific functions
3 participants