-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
PR: Add permanent history to the debugger #10010
Conversation
Hello @impact27! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:
Comment last updated at 2019-08-23 13:52:17 UTC |
b484822
to
0f81d96
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@impact27, I left a couple of minor comments, otherwise looks good.
0f81d96
to
865b39f
Compare
865b39f
to
947f57a
Compare
I know this is not the best solution, but it's good enough until we have time to seriously improve our debugger (which is not going to happen for Spyder 4, but probably for version 5). |
The only think that could be
I have been playing with that a bit and there is a problem with multilines inputs. I will try to fix that with sqlite. |
You shouldn't waste your time with that because the solution we're thinking to implement doesn't involve enhancing IPdb but creating a debugging kernel. Besides, I think multiline is really not an option in Pdb because you have to prefix Python code with |
I used |
I'm -1 on that and I'd like you to revert that change. That not only makes things more complex than they need to be, but also there's no need of it because you can write multi-line statements in Pdb. |
Well the complexity is all in import numpy as np
np.abs([1,
2]) If I want to copy-paste the But in the old implementation, as a newline separate the statement, I ended up with: history = [
'import numpy as np',
'np.abs([1,',
' 2])'] With the new implementation, the newlines are not specific characters, so there is no problem. Using Futhermore, all the tools that are used to manage ipython history can be easily adapted to manage this new pdb history. I therefore believe that this implementation is more future proof and has less bugs. |
I mean with a database I can store executed cells, not just lines, and I can attach more informations, such as the session this line was from, the line number, and more. So in the future if we want to add functionalities to the history, the database already exists and we don't need to migrate from a text file. |
I haven't considered this use case (I don't know how it could arise, besides copy/paste).
Cells executed with
Ok, that's a good point too. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left a couple of minor comments, but I'd like to mention two other things:
-
I think the main changes could be moved to
DebuggingWidget
, right? I mean, I don't see anything in them that requires theControlWidget
interface now. -
A test for this is missing. It can consist on creating a console, entering debug mode and writing a command on it, then opening a new console and verifying that that command was saved correctly in the debugging history.
That test can replace the contents of current
test_browse_history_dbg
test, present intest_ipythonconsole.py
.
Multiline statment pasted by the user in pdb, but it still needs to be a single statment. otherwise: |
@impact27, this now needs a merge with master. |
There is a small issue with backward search in pdb that I will have a look at now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @impact27!! Another great addition of yours!
Description of Changes
Small changes to pdb to save the history, so I can access the history of a previous debugging session.
This is not a really nice way of doing thing, but it works. Two (non easy) way of improving this:
(Well only kind of because the history is duplicated, see PR: Load history from IPython directly #7141 )
Issue(s) Resolved
Fixes #
Affirmation
By submitting this Pull Request or typing my (user)name below,
I affirm the Developer Certificate of Origin
with respect to all commits and content included in this PR,
and understand I am releasing the same under Spyder's MIT (Expat) license.
I certify the above statement is true and correct: