Call IPython.enable_gui when install repl displayhook#28332
Merged
tacaswell merged 1 commit intomatplotlib:mainfrom Jun 3, 2024
Merged
Call IPython.enable_gui when install repl displayhook#28332tacaswell merged 1 commit intomatplotlib:mainfrom
tacaswell merged 1 commit intomatplotlib:mainfrom
Conversation
Member
Author
|
IPython PR is ipython/ipython#14451. |
timhoffm
approved these changes
Jun 3, 2024
tacaswell
approved these changes
Jun 3, 2024
meeseeksmachine
pushed a commit
to meeseeksmachine/matplotlib
that referenced
this pull request
Jun 3, 2024
QuLogic
added a commit
that referenced
this pull request
Jun 3, 2024
…332-on-v3.9.x Backport PR #28332 on branch v3.9.x (Call IPython.enable_gui when install repl displayhook)
Carreau
added a commit
to ipython/ipython
that referenced
this pull request
Jun 25, 2024
This is a bug that I discovered whilst dealing with matplotlib/matplotlib#28332. The change here is in `TerminalInteractiveShell.enable_gui` which needs to convert a gui of `macosx` from Matplotlib into `osx` in IPython. It reuses the converter function created in #14420. I've added a test that uses `enable_gui` and raises an exception before this PR but passes with it. The remainder of the changes are formatting changes from `pre-commit`.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #28324.
This fixes the use of
plt.show(block=False)inipythonwithout specifying a particular backend beforehand. The recent refactor of backend handling in IPython/Matplotlib removed the call toip.enable_guiininstall_repl_displayhookbut in this particular use case it is still needed. If a backend is specified in ipython beforehand (viaipython --matplotlibor%matplotlibfor example) then IPython already knows about the correct event loop, but if not then IPython needs to be explicitly told about it viaip.enable_gui.So really this is putting functionality back in that I erroneously removed in the backend refactor.
On macos the default
macosxbackend needs an extra fix in IPython that I will link to.