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

Make pyplot more tolerant wrt. 3rd-party subclasses.#12293

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
jklymak merged 2 commits intomatplotlib:masterfromanntzer:tolerant-pyplot
Oct 6, 2018

Conversation

anntzer
Copy link
Contributor

@anntzeranntzer commentedSep 26, 2018
edited
Loading

Don't force them to reproduce the names of "intended-as-positional"
arguments; don't force them to support the data kwarg.

xref#12288

attn@QuLogic can you pick it up from there if more changes are needed?

PR Summary

PR Checklist

  • Has Pytest style unit tests
  • Code isFlake 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

@anntzeranntzer added the Release criticalFor bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions. labelSep 26, 2018
@anntzeranntzer added this to thev3.0.x milestoneSep 26, 2018
@anntzeranntzerforce-pushed thetolerant-pyplot branch 2 times, most recently from0755ea7 to7ddf5fdCompareSeptember 26, 2018 08:35
jklymak
jklymak previously requested changesSep 26, 2018
Copy link
Member

@jklymakjklymak left a comment

Choose a reason for hiding this comment

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

The fact that all this didn't trip any test changes means to me that we aren't testing the signatures completely, and that is making breaking changes opaque to us, but a problem for downstream packages. If we decide to change the signatures, that should fail some tests, which can then consciously be removed if need be, and accompanied by the appropriate API change notes. (i.e. the changes made in#10918 shoudl have failed some tests so we knew we were causing problems, so this is the time to add those tests)

@anntzer
Copy link
ContributorAuthor

It's going to be pretty tricky to test this unless we make a copy of all pyplot signatures somewhere else to compare against, which sounds not so nice.

@jklymak
Copy link
Member

I don’t think they all have to be tested just a smattering to make sure the boilerplate is doing the right thing.

I do t understand what you mean by copying all the pyot signatures but maybe I’m misunderstanding what is going on here

@anntzer
Copy link
ContributorAuthor

It's not clear to me what test you exactly want to add either...

@jklymak
Copy link
Member

Ideally there would be some tests that would have failed#10918, which presumably means duplicating whatever signature cartopy was trying to use. But again if there is a more informed critical mass of devs who don't think this is possible they should feel free to dismiss my review. I'm not claiming deep understanding

@QuLogic
Copy link
Member

I have not gone through the changes, but this is sufficient to get Cartopy tests working again. Keep in mind that Cartopy does not of course exercise the entirety of thepyplot API, just the following:

$ rg --no-filename -o 'plt\.[A-Za-z0-9_]+' | sort -uplt.autoscaleplt.axesplt.clfplt.closeplt.contourplt.contourfplt.drawplt.figureplt.gcaplt.gcfplt.get_backendplt.imreadplt.imshowplt.pcolorplt.pcolormeshplt.plotplt.savefigplt.scatterplt.showplt.subplotplt.subplots_adjustplt.switch_backendplt.xlimplt.ylim

@anntzer
Copy link
ContributorAuthor

anntzer commentedSep 27, 2018
edited
Loading

TBH I am not particularly interested in figuring out how to do implement a test (especially wrt what guarantees we want to make regarding the subclassability of Axes).

@jklymak
Copy link
Member

TBH I am not particularly interested in figuring out how to do implement a test (especially wrt what guarantees we want to make regarding the subclassability of Axes).

I think all I'm asking for are tests that test the allowed signatures, which I think is where the downstream subclasses are tripping up. But again, anyone who understands this better can dismiss my review if I'm off base about the testability of this.

@anntzer
Copy link
ContributorAuthor

Can you open the request for tests as a separate issue instead?

@jklymakjklymak dismissed theirstale reviewOctober 5, 2018 21:26

I still think we should test these code paths so we don't break things like this in the future.

Don't force them to reproduce the names of "intended-as-positional"arguments; don't force them to support the data kwarg.This is also necessary for methods that take `*args`, as otherwisewe generate a call of the form `foo=foo, *args` which is incorrectlyunderstood as `*args, foo=foo`.
@anntzer
Copy link
ContributorAuthor

Clarified in the commit message why this also closes#12405.

dstansby
dstansby previously requested changesOct 6, 2018
Copy link
Member

@dstansbydstansby left a comment

Choose a reason for hiding this comment

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

I think it's reasonable to request at least one small smoke test be added to this PR to check that all is working. The short example in#12405 should be enough

@anntzer
Copy link
ContributorAuthor

Can you push it?

@dstansby
Copy link
Member

Done!

Copy link
Member

@QuLogicQuLogic left a comment

Choose a reason for hiding this comment

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

Works for Cartopy.

@jklymak
Copy link
Member

pyplot signatures need more tests

@efiringefiring mentioned this pull requestOct 7, 2018
6 tasks
@anntzeranntzer deleted the tolerant-pyplot branchOctober 7, 2018 02:02
jklymak added a commit that referenced this pull requestOct 7, 2018
…293-on-v3.0.xBackport PR#12293 on branch v3.0.x (Make pyplot more tolerant wrt. 3rd-party subclasses.)
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@tacaswelltacaswelltacaswell approved these changes

@QuLogicQuLogicQuLogic approved these changes

@jklymakjklymakjklymak left review comments

@dstansbydstansbydstansby left review comments

Assignees
No one assigned
Labels
Release criticalFor bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.
Projects
None yet
Milestone
v3.0.1
Development

Successfully merging this pull request may close these issues.

5 participants
@anntzer@jklymak@QuLogic@dstansby@tacaswell

[8]ページ先頭

©2009-2025 Movatter.jp