jupyter / jupyter_console

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

Attaching a Jupyter console for remote introspection/debugging? #207

Open sjdv1982 opened 4 years ago

sjdv1982 commented 4 years ago

I have an asyncio-based server application. During development I can do live introspection and debugging using ipython:

ipython -i server.py -- [server args]

While during production, I do something like

python server.py --run-forever  [server args]

(where --run-forever does asyncio.get_event_loop().run_forever() at the end of the server script)

It would be very nice if during production, I could still attach (remotely) a Jupyter console to that (or multiple consoles), using jupyter console --existing.

The trouble is, I can't see how to launch a proper ipykernel in the first place.

jupyter console server.py -- --run-forever [server args] does not work,

nor does ipython kernel -i server.py -- [server args].

Is this supported by either? Or do I need to write my own ipykernel.kernelapp subclass?