Skip to content
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

Fix IPython inputhook (workaround). #1811

Merged
merged 1 commit into from
Nov 14, 2023

Conversation

jonathanslenders
Copy link
Member

@jonathanslenders jonathanslenders commented Nov 14, 2023

Workaround to make IPython inputhooks work again, until ipython/ipython#14241 is merged.

@jonathanslenders jonathanslenders merged commit 8c60193 into master Nov 14, 2023
12 checks passed
@jonathanslenders jonathanslenders deleted the ipython-inputhook-workaround branch November 14, 2023 08:49
@tornaria
Copy link
Contributor

This now causes a deprecation warning when running sagemath on python 3.12 with prompt_toolkit 3.0.41:

$ sage
┌────────────────────────────────────────────────────────────────────┐
│ SageMath version 10.1, Release Date: 2023-08-20                    │
│ Using Python 3.12.0. Type "help()" for help.                       │
└────────────────────────────────────────────────────────────────────┘
/usr/lib/python3.12/site-packages/prompt_toolkit/application/application.py:988: DeprecationWarning: There is no current event loop
  loop = asyncio.get_event_loop()
sage: 

But we are shipping ipython 8.18 (void linux) so I think this workaround is no longer required.

Is there any suggested way to move forward on this so that asyncio.get_event_loop() is not called when running python 3.12 and ipython 8.18 ? Are we expected to patch out this PR in our prompt_toolkit. Do you intend to do that in the future?

@tornaria
Copy link
Contributor

Maybe, this is being called from ipython, then import IPython and check IPython.version_info < (8, 18, 0, '') to actually do the workaround ?

@jonathanslenders
Copy link
Member Author

@tornaria: Would you mind creating a pull request which adds the IPython version test? Maybe in _called_from_ipython() return False for newer IPython versions. For those we don't need the workaround any longer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants