Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
making onselect a keyword argument on selectors#26000
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Uh oh!
There was an error while loading.Please reload this page.
lib/matplotlib/widgets.py Outdated
@@ -3245,7 +3249,8 @@ class RectangleSelector(_SelectorWidget): | |||
See also: :doc:`/gallery/widgets/rectangle_selector` | |||
""" | |||
def __init__(self, ax, onselect, *, minspanx=0, minspany=0, useblit=False, | |||
def __init__(self, ax, *, onselect=None, minspanx=0, |
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.
def__init__(self,ax,*,onselect=None,minspanx=0, | |
def__init__(self,ax,onselect=None,*,minspanx=0, |
The*
makes it keyword only which would require deprecation etc. I think it make sense to provide a default value, but not require old code to passonselect
with a keyword. (I guess you just forgot about this line.)
Not really sure about the mypy tests. I think you need to update the Also, I think it would be good to add a "smoke test" for this. That is, call one of the selectors without an
before that call. |
Oh, and reading#21929 I am not sure that this closes the issue. It is clearly a good contribution taking care of parts of it though. |
tacaswell left a comment• edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
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.
Agree with Oscar, changing to keyword only is a breaking change.
We should either go with just giving it a default value to make it optional (my preference) or actually do the derprecation (see the_api.make_keyword_only
decorator that already exists in this file).
One way or the other we need a whats new and/or API change note.
Anyone can dismiss this review.
Thank you for your work on this@thiagoluisbecker . Could you also add a test of creating |
Hi! Apologies for the delay. I understand the suggestions and I will implement them. Thanks for the answers. |
ping@thiagoluisbecker. Are you still planning to work on this? |
Hi! No. |
QuLogic commentedSep 20, 2024 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
This seems straightforward, so I've rebased, fixed the comments, added a what's new note, and modified tests to drop the Also note that there's also |
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.
Subject to deciding if it#21929 should be closed or not.
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 a good step forward and does not bar later removal. In fact, it makes it slightly simpler since people can from now on leave outonselect
if they don't need it, which will make their code forward-compatible with a possible future removal.
Optional: We could deprecate for kw-only use for onselect and following arguments, which would make potential later removal simpler. But that can also be done in a follow-up. |
fe6389f
intomatplotlib:mainUh oh!
There was an error while loading.Please reload this page.
PR summary
closes#21929
Making onselect a keyword argument on Selectors(widgets.py) with no-op functions following the suggestion made in this issue comment:#21929 (comment).
PR checklist
onselect
/onmove_callback
of selectors #21929 " is in the body of the PR description tolink the related issue