prompt-toolkit / python-prompt-toolkit

Library for building powerful interactive command line applications in Python
https://python-prompt-toolkit.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
9.1k stars 717 forks source link

Fix inputhook implementation to be compatible with asyncio.run(). #1810

Closed jonathanslenders closed 7 months ago

jonathanslenders commented 7 months ago

asyncio.get_event_loop() got deprecated. So we can't install an event loop with inputhook upfront and then use in in prompt_toolkit. Instead, we can take the inputhook as an argument in Application.run() and PromptSession.run(), and install it in the event loop that we create ourselves using asyncio.run().