-
Notifications
You must be signed in to change notification settings - Fork 4
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
Deprecate operator dispatch in Var
#192
base: main
Are you sure you want to change the base?
Conversation
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.
I doesn't make a big difference, but technically we want to be sure that we warn users if they do anything that will break in the future. If we remove operator_overloading
in the future any from spox._future import operator_overloading
will already break regardless of usage. As such, we would ideally already warn on that level. One way to do so is to rename the function to _operator_overloading
and then define a getattr
function in the module to return it if a user imports "operator_overloading". We may then raise the warning from getattr
rather than when the user actually calls the function. This comes with the added benefit that it would already remove the function from the documentation, too.
Co-authored-by: Christian Bourjau <[email protected]>
I think it should now work as described here^ Note: These are how the different situations get handled after the change, using the developer mode: # warning
from spox._future import operator_overloading
# no warning
import spox._future as sf
# warning
sf.operator_overloading
# no warning
from spox._future import set_type_warning_level
# ImportError
from spox._future import non_existant_function |
Operator dispatch is a too high-level feature for
spox
. Also it is currently clunky to use from a user standpoint as it essentially "monkey-patches" the dispatcher inspox
.A more appropriate way to access this behaviour is by using ndonnx.
Checklist
CHANGELOG.rst
entry