-
Notifications
You must be signed in to change notification settings - Fork 141
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 universal methods #241
Conversation
In the rust generated Python API we need to have fixed class inpurts to satisfy the traits used by the pyo3 macro generated FFI functions. This results in duplicate methods like digraph_dfs_edges and graph_dfs_edges with the same implementation just differing input types. To simplify the API for users this commit adds universal functions to the python side of the retworkx package to take in any retworkx graph object and dispatch to the proper function in the rust generated api that relies on strict input types. Fixes Qiskit#215
Pull Request Test Coverage Report for Build 528817992
💛 - Coveralls |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is so awesome!! 🎉
The only "oof" I have is: if you have to fix a typo in a docstring, or if you want to change a default value, you have to change it now in three places 😬
Yeah I couldn't figure out a way around that. :( We still need to export the per type functions both so they're accessible for the dispatch functions and for backwards compat. If we're going to be exporting the functions we'll want them to be documented. |
In the rust generated Python API we need to have fixed class inpurts to
satisfy the traits used by the pyo3 macro generated FFI functions. This
results in duplicate methods like digraph_dfs_edges and graph_dfs_edges
with the same implementation just differing input types. To simplify the
API for users this commit adds universal functions to the python side of
the retworkx package to take in any retworkx graph object and dispatch to
the proper function in the rust generated api that relies on strict
input types.
Fixes #215