Skip to content

In the new/simplified backend API, don't customize draw_if_interactive. #23291

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 11, 2022

Conversation

anntzer
Copy link
Contributor

@anntzer anntzer commented Jun 16, 2022

The customization point is not really needed (it can go into the canvas
constructor or manager.show or a few other places), but removing support
for it would be a bit tricky if not coupled with the introduction of a
new API (manager_class). This way, we can simply say "if you want to
use the new API, then you cannot customize draw_if_interactive".

backend_template gets updated without deprecation as the point of that
backend is really to be documentation for what a backend module is;
moreover, putting a deprecation on new_figure_manager (for example)
would actually be counter-productive as pyplot would still try to call
that function (and thus emit a warning, even though the backend itself
is not deprecated).

Closes #23105. See that PR for a more detailed discussion.

Once merged, the documentation added at #23101 will need a slight tweak as well.

PR Summary

PR Checklist

Tests and Styling

  • Has pytest style unit tests (and pytest passes).
  • Is Flake 8 compliant (install flake8-docstrings and run flake8 --docstring-convention=all).

Documentation

  • New features are documented, with examples if plot related.
  • 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).
  • Documentation is sphinx and numpydoc compliant (the docs should build without error).

@anntzer anntzer added Release critical For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions. topic: canvas and figure manager labels Jun 16, 2022
@anntzer anntzer added this to the v3.6.0 milestone Jun 16, 2022
@anntzer anntzer force-pushed the udif branch 2 times, most recently from 9ff890b to 2db643e Compare June 17, 2022 10:57
@@ -303,6 +302,7 @@ def new_figure_manager(num, *args, FigureClass=Figure, **kwargs):
backend_mod.new_figure_manager_given_figure = \
new_figure_manager_given_figure
backend_mod.new_figure_manager = new_figure_manager
backend_mod.draw_if_interactive = matplotlib.backend_bases._Backend
Copy link
Member

Choose a reason for hiding this comment

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

missing .draw_if_interactive.

Copy link
Contributor Author

@anntzer anntzer Jul 7, 2022

Choose a reason for hiding this comment

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

Actually this should just use a local reimplementation (to avoid the check on _Backend.mainloop, which is wrong here as third-parties will not have overridden that), fixed.

The customization point is not really needed (it can go into the canvas
constructor or manager.show or a few other places), but removing support
for it would be a bit tricky if not coupled with the introduction of a
new API (manager_class).  This way, we can simply say "if you want to
use the new API, then you cannot customize draw_if_interactive".

backend_template gets updated without deprecation as the point of that
backend is really to be documentation for what a backend module is;
moreover, putting a deprecation on new_figure_manager (for example)
would actually be counter-productive as pyplot would still try to call
that function (and thus emit a warning, even though the backend itself
is not deprecated).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Release critical For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions. topic: canvas and figure manager
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[MNT]: Deprecate per-backend customization of draw_if_interactive
3 participants