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

Connect to an existing kernel #267

Closed
fecet opened this issue Apr 10, 2023 · 7 comments
Closed

Connect to an existing kernel #267

fecet opened this issue Apr 10, 2023 · 7 comments

Comments

@fecet
Copy link

fecet commented Apr 10, 2023

Possible to attach ipdb to an existing kernel?

Currently, ipdb starts a new kernel session each time it is called, which can be inconvenient and time-consuming. If ipdb could connect to an existing kernel session, it would be much more efficient for debugging.

I believe this feature would be useful for many developers who use ipdb in conjunction with Jupyter notebooks or other interactive environments.

@gotcha
Copy link
Owner

gotcha commented Apr 11, 2023

ipdb is a community project. PR welcome !

@fecet
Copy link
Author

fecet commented Apr 14, 2023

I found a workaround is to use jupyter console to connect and use ipdb in it, but the ipdb in jupyter console seems buggy and fallback to a "naive" terminal, arrow key and tab not work as in ipython per jupyter/jupyter_console#162. Why this happen?

@gotcha
Copy link
Owner

gotcha commented Apr 14, 2023

I am not a regular Jupyter user so I am afraid I cannot really help.

Nevertheless, can you detail what you mean by using ipdb in jupyter ?

@fecet
Copy link
Author

fecet commented Apr 14, 2023

Enter jupyter console, trigger an error like 1/0, then use %debug enter it:
image
You can see the name of ipdb is white, arrow keys will result escape sequences and tab will print a whitespace and wouldn't trigger completion.
If we enter ipython and do the same things, we get
image
where the ipdb is green, indicate it work like in ipython, and it did, we can use arrow keys to navigate history and trigger completion by tab in it.

@gotcha
Copy link
Owner

gotcha commented Apr 14, 2023

jupyter-console does not depend on ipdb as shown here: https://github.com/jupyter/jupyter_console/blob/main/pyproject.toml

I guess that the ipdb prompt displayed in jupyter-console is the IPython debugger.
IOW, issues with the ipdb in jupyter-consoleshould be reported to the maintainers of that package.

(Similarly, ipdb is a wrapper around the given debugger.)

@gotcha
Copy link
Owner

gotcha commented Apr 14, 2023

Possible to attach ipdb to an existing kernel?

Currently, ipdb starts a new kernel session each time it is called, which can be inconvenient and time-consuming. If ipdb could connect to an existing kernel session, it would be much more efficient for debugging.

The same way, I guess that the ipdb you refer here is not this package.
Did you install the ipdb package in any way ?

@fecet
Copy link
Author

fecet commented Apr 14, 2023

You are correct. According to the information found at jupyter/qtconsole#143 and jupyter/qtconsole#99, it appears that this is an open problem. Thank you for sharing your insight, and I apologize for opening this here

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

No branches or pull requests

2 participants