Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
ENH: by-pass creating a local class if backend has a Backend class#22380
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
anntzer commentedFeb 3, 2022 • 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.
I guess we need to standardize on a name there, effectively saying "a module with a Foo global is a backend". I'm fine with calling that Backend, I just want to make sure we agree on the name. OTOH, another approach (#18854) would be to move "everything" to the FigureCanvas class ("a module with a FigureCanvas global is a backend"). (Note, in particular, that this allows reusing the already preexisting inheritance relationship that exists between canvases.) Perhaps you can comment on that PR? |
I like#18854 a lot better. It gives you a path to fromjust a Figure walk your way up to building it a sibling in whatever scheme of canvas / manager / show / etc the user has put together. I had thought about attaching the Backend object to Thinking a bit more about the toolbar discussion, I think having down-stream sub-class either the Manger or Toolbar classes is not a terrible pattern to suggest. We tend to think in terms of libraries and compos-ability (which makes sense given our interest in working at the library level!), but the cases where I have seen where there is significant toolbar customization have been domain specific applications (the buttons the added only made sense in avery narrow science context) where the lack of being able to compose with another packages modifications does not matter. Closing in favor of#18854 where (as normal)@anntzer is a few steps ahead of me. |
PR Summary
Simplify using a backend that has a backend class. I think this is the next step down the path@anntzer started us on.
There is analogous code in mpl-gui athttps://github.com/tacaswell/mpl-gui/blob/bc0cdc7bd58095039f124516cd6ca88611509513/mpl_gui/_manage_backend.py#L87-L109 .
It may be worth holding this PR until we sort out if there is anything else we want to hoist upstream from mpl_gui.
PR Checklist
Tests and Styling
pytest
passes).flake8-docstrings
and runflake8 --docstring-convention=all
).This is implicitly tested, but might be worth pushing in some explicit tests of when the local backend does or does not get created.
Documentation
doc/users/next_whats_new/
(follow instructions in README.rst there).doc/api/next_api_changes/
(follow instructions in README.rst there).