Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Expire deprecations in widgets and keyword only arguments for Selectors#24254

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

Merged
greglucas merged 4 commits intomatplotlib:mainfromoscargus:widgetsexpiration
Jan 12, 2023

Conversation

oscargus
Copy link
Member

@oscargusoscargus commentedOct 22, 2022
edited
Loading

PR Summary

Will add notes etc, but think about the keyword-only aspect of Selectors/Widgets.Also,lineprops is unused in RectangleSelector, but I guess I cannot really remove it?

PR Checklist

Tests and Styling

  • Has pytest style unit tests (andpytest passes).
  • IsFlake 8 compliant (installflake8-docstrings and runflake8 --docstring-convention=all).

Documentation

  • New features are documented, with examples if plot related.
  • New features have an entry indoc/users/next_whats_new/ (follow instructions in README.rst there).
  • API changes documented indoc/api/next_api_changes/ (follow instructions in README.rst there).
  • Documentation is sphinx and numpydoc compliant (the docs shouldbuild without error).

@greglucas
Copy link
Contributor

I think this is only missing a removal note?

@QuLogic
Copy link
Member

Also,lineprops is unused in RectangleSelector, but I guess I cannot really remove it?

It's decorated withdelete_parameter, so it should be removed.

@tacaswell
Copy link
Member

Agree with Elliott that we can fully removedrawtype, but the UI won't let me add the patches. Also agree with Greg that this needs a removal note.

@oscargus
Copy link
MemberAuthor

The main thing here is the modified keyword only arguments. I wanted some feedback on that before continuing with release notes. But I take it that it makes sense, at least sort of.

Will get to the release notes then.

@oscargusoscargusforce-pushed thewidgetsexpiration branch 3 times, most recently from648b4a8 to6155b7eCompareDecember 15, 2022 21:12
"""

def __init__(self, ax, xy, callback=None, useblit=True):
@_api.make_keyword_only("3.7", name="useblit")
def __init__(self, ax, xy, callback, useblit=True):
Copy link
MemberAuthor

Choose a reason for hiding this comment

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

callback cannot be None, so it doesn't make sense to have a default value (despite this going back 17 years...).

Copy link
Member

Choose a reason for hiding this comment

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

I'm inclinded that we wantcallback keyword-only as well.

FYI you can have keyword-only arguments without a default. This is valid:

def __init__(self, ax, xy, *, callback, useblit=True):

and would be called as

Lasso(ax, xy, callback=foo)

However, to be checked whethermake_keyword_only does work correctly for such a situation.

Copy link
Member

Choose a reason for hiding this comment

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

I'm a bit skeptical of changing callback to be keyword only. The only place we use this in a demo it is passed positionally. I am worried that we are going to get minor payoff at the cost of thrashing a bunch of user code.

Copy link
Contributor

Choose a reason for hiding this comment

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

I would not make it kwonly; it should be pretty clear in the context that that argument is a callback. The point of making e.g. useblit kwonly is that if you writeLasso(ax, xy, somefunc, True), it is really not clear whatTrue is (useblit=True is clearer), but it is quite obvious that somefunc is a callback (especially as it'll typically have a more meaningful name, e.g. onselect; if it's a lambda defined inline (Lasso(ax, xy, lambda vertices: ...)) the situation is also clear).

def __init__(self, ax, onselect=None, useblit=True, props=None,
button=None):
@_api.make_keyword_only("3.7", name="useblit")
def __init__(self, ax, onselect, useblit=True, props=None, button=None):
Copy link
MemberAuthor

Choose a reason for hiding this comment

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

onselect cannot beNone (and isn't in any other Selector).

@oscargusoscargus added the Release criticalFor bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions. labelDec 15, 2022
@oscargusoscargus marked this pull request as ready for reviewDecember 15, 2022 21:30
"""

def __init__(self, ax, xy, callback=None, useblit=True):
@_api.make_keyword_only("3.7", name="useblit")
def __init__(self, ax, xy, callback, useblit=True):
Copy link
Member

Choose a reason for hiding this comment

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

I'm inclinded that we wantcallback keyword-only as well.

FYI you can have keyword-only arguments without a default. This is valid:

def __init__(self, ax, xy, *, callback, useblit=True):

and would be called as

Lasso(ax, xy, callback=foo)

However, to be checked whethermake_keyword_only does work correctly for such a situation.


- The *lineprops* argument is removed, use *props* instead.
- The ``onpress`` and ``onrelease`` methods are removed. They are straight
aliases for ``press`` and ``release``.
Copy link
Member

Choose a reason for hiding this comment

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

Removal ofTextBox.DIST_FROM_LEFT is missing.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

FWIW this is all just copied and pasted from the 3.5 release notes and deprecated replaced with removed (more or less).

But I will of course edit accordingly.

Copy link
Member

Choose a reason for hiding this comment

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

Looks like this was deprecated inbd9ee5e but we did not get a API change note with it.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Should I update this to be deprecated in 3.7?

Copy link
Member

Choose a reason for hiding this comment

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

It has been warning, but was not documented. The conservative thing to do is put it back, document it removed in 3.7 and drop it in 3.8, but I'm inclined to be a bit YOLO here and just document that it is removed in 3.7 as this is a very niche feature...

@tacaswell
Copy link
Member

I think the outstanding tasks here are:

  • document TextBox.DIST_FROM_LEFT is removed. maybe retroactively add it to the API docs for 3.6.
  • drop the extra()
  • rebase

@timhoffm
Copy link
Member

Optional:#24254 (comment)

It would be nice to directly includecallback while we're at making things kwonly. But if that's to complicated, we can defer that.

oscargusand others added2 commitsJanuary 11, 2023 15:17
Co-authored-by: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com>
We do not actually use it in the code so also remove setting it.
@greglucasgreglucas merged commitaa426be intomatplotlib:mainJan 12, 2023
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull requestJan 12, 2023
oscargus added a commit that referenced this pull requestJan 12, 2023
…254-on-v3.7.xBackport PR#24254 on branch v3.7.x (Expire deprecations in widgets and keyword only arguments for Selectors)
@oscargusoscargus deleted the widgetsexpiration branchJanuary 12, 2023 21:58
@ksundenksunden mentioned this pull requestFeb 20, 2023
6 tasks
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@anntzeranntzeranntzer left review comments

@timhoffmtimhoffmtimhoffm left review comments

@tacaswelltacaswelltacaswell approved these changes

@QuLogicQuLogicQuLogic approved these changes

@greglucasgreglucasgreglucas approved these changes

Assignees
No one assigned
Labels
API: changesMaintenanceRelease criticalFor bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.topic: widgets/UI
Projects
None yet
Milestone
v3.7.0
Development

Successfully merging this pull request may close these issues.

6 participants
@oscargus@greglucas@QuLogic@tacaswell@timhoffm@anntzer

[8]ページ先頭

©2009-2025 Movatter.jp