jupyter / jupyter_console

Jupyter Terminal Console
http://jupyter-console.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
247 stars 146 forks source link

Use loop.create_task with interact() #270

Closed encukou closed 2 years ago

encukou commented 2 years ago

Passing coroutines directly to asyncio.wait is deprecated since Python 3.8, as it leads to confusing behavior.

In Python 3.11, wait() will no longer accept coroutines and must be given Tasks.

hroncok commented 2 years ago

I can confirm this actually works.

davidbrochart commented 2 years ago

Thanks @encukou. Maybe we could also get rid of asyncio.get_event_loop(), which is deprecated since Python 3.10. It will become an alias to asyncio.get_running_loop(), and this code will break.

encukou commented 2 years ago

OK, here's a bigger change: all the code that needs the loop moved to an async function, run by asyncio.run.

This makes several loop arguments unused, but I don't know if something depends on it being there, so I didn't remove it.

encukou commented 2 years ago

Is it OK to drop compatibility with Python 3.6?

davidbrochart commented 2 years ago

Yes it is, do you also want to update setup.py?

davidbrochart commented 2 years ago

Thanks a lot @encukou!