Title: Explicit registration of canvas-specific tool subclasses. by anntzer · Pull Request #20990 · matplotlib/matplotlib · GitHub
Open Graph Title: Explicit registration of canvas-specific tool subclasses. by anntzer · Pull Request #20990 · matplotlib/matplotlib
X Title: Explicit registration of canvas-specific tool subclasses. by anntzer · Pull Request #20990 · matplotlib/matplotlib
Description: Don't mess up with overwriting backend_tools globals, which would fail if multiple backend modules are imported. This proposes an API to fix #17986 (and therefore unblock #20273 (comment)). I had tried another approach back in #9941, but that PR did many more cleanups at the same time and therefore got bogged down in side discussions; this one solely implements canvas-specific tool subclass registration. That registration mechanism is private for now, but we can always consider making it public if there's demand for it. (I actually guess there would not be that much demand for third-party tool implementers because even if the tool really required some backend-specific logic, it could just use a plain old if-switch instead (https://github.com/anntzer/mplinorm/blob/dbd0b34ab4b2ad3799410565ec6ad31f992b7576/lib/mplinorm.py#L162) because a single module/package would provide the tools; the dispatch problem on Matplotlib's side mostly comes from the fact that each backend implements its own tools in its own module. The only case where this would really be necessary for third parties is for integration into a new event loop.) (See the linked PRs and issues for more details about the problem this is solving.) attn @fariza, I guess. PR Summary PR Checklist Has pytest style unit tests (and pytest passes). Is Flake 8 compliant (run flake8 on changed files to check). New features are documented, with examples if plot related. Documentation is sphinx and numpydoc compliant (the docs should build without error). Conforms to Matplotlib style conventions (install flake8-docstrings and run flake8 --docstring-convention=all). New features have an entry in doc/users/next_whats_new/ (follow instructions in README.rst there). API changes documented in doc/api/next_api_changes/ (follow instructions in README.rst there).
Open Graph Description: Don't mess up with overwriting backend_tools globals, which would fail if multiple backend modules are imported. This proposes an API to fix #17986 (and therefore unblock #20273 (comment)). I ...
X Description: Don't mess up with overwriting backend_tools globals, which would fail if multiple backend modules are imported. This proposes an API to fix #17986 (and therefore unblock #20273 (comment))....
Opengraph URL: https://github.com/matplotlib/matplotlib/pull/20990
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:dc9ecfe4-9b9b-9852-02c3-876be68581c2 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | 8382:349E24:286CC:34ECF:6A556EBE |
| html-safe-nonce | 09847a21bc03547b41b38ec6fb73f49f8e27047ffe5fe3df9c3a038e727b5cb4 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MzgyOjM0OUUyNDoyODZDQzozNEVDRjo2QTU1NkVCRSIsInZpc2l0b3JfaWQiOiI1NjY1MDIxNTc0MTE5NzgwMDMwIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 04f36f7500d795db07ce5152a039117ed7e05998751f45e4da31c0d710bcd38d |
| hovercard-subject-tag | pull_request:727029487 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/matplotlib/matplotlib/pull/20990/files |
| twitter:image | https://avatars.githubusercontent.com/u/1322974?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/1322974?s=400&v=4 |
| og:image:alt | Don't mess up with overwriting backend_tools globals, which would fail if multiple backend modules are imported. This proposes an API to fix #17986 (and therefore unblock #20273 (comment)). I ... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | b5665c84831ed9ac4fb79519c16c9c5580ba8092fb8bb6e3e72972ec7197348e |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/matplotlib/matplotlib git https://github.com/matplotlib/matplotlib.git |
| octolytics-dimension-user_id | 215947 |
| octolytics-dimension-user_login | matplotlib |
| octolytics-dimension-repository_id | 1385122 |
| octolytics-dimension-repository_nwo | matplotlib/matplotlib |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1385122 |
| octolytics-dimension-repository_network_root_nwo | matplotlib/matplotlib |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | a90bd2a4a25feb75544d06b89350dcf95d9c46e0 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width