gotcha / ipdb

Integration of IPython pdb
BSD 3-Clause "New" or "Revised" License
1.85k stars 146 forks source link

Share history between different sessions #190

Closed gotcha closed 2 years ago

gotcha commented 4 years ago

based on @michelesr work

see #104

codecov-io commented 4 years ago

Codecov Report

Merging #190 into master will decrease coverage by 3.68%. The diff coverage is 21.21%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #190      +/-   ##
==========================================
- Coverage   67.15%   63.46%   -3.69%     
==========================================
  Files           6        6              
  Lines         344      375      +31     
==========================================
+ Hits          231      238       +7     
- Misses        113      137      +24
Impacted Files Coverage Δ
ipdb/__main__.py 43.13% <21.21%> (-3.69%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 251adcc...5133c44. Read the comment docs.

Suor commented 4 years ago

Not sure I installed everything correctly, but I get:

Traceback (most recent call last):
  File "parse_repo.py", line 20, in <module>
    main()
  File "parse_repo.py", line 10, in main
    import ipdb; ipdb.set_trace()
  File "/home/suor/.virtualenvs/viewer/lib/python3.8/site-packages/ipdb/__main__.py", line 123, in set_trace
    p = _init_pdb(context).set_trace(frame)
  File "/home/suor/.virtualenvs/viewer/lib/python3.8/site-packages/ipdb/__main__.py", line 100, in _init_pdb
    p = Pdb(context=context)
  File "/home/suor/.virtualenvs/viewer/lib/python3.8/site-packages/IPython/terminal/debugger.py", line 32, in __init__
    self.pt_init()
  File "/home/suor/.virtualenvs/viewer/lib/python3.8/site-packages/ipdb/__main__.py", line 65, in pt_init
    history.append(unicode(line.replace(os.linesep, '')))
AttributeError: 'InMemoryHistory' object has no attribute 'append'

Installed via:

pip install git+https://github.com/gotcha/ipdb.git@history

EDIT. Have ipython version 7.13.0. EDIT2. Tried ipython==5.9 got:

  File "/home/suor/.virtualenvs/viewer/lib/python3.8/site-packages/ipdb/__main__.py", line 65, in pt_init
    history.append(unicode(line.replace(os.linesep, '')))
NameError: name 'unicode' is not defined
gotcha commented 4 years ago

@Suor Thanks for testing. I guess there is a need for more automated testing before this can be released

alexandrebarbaruiva commented 4 years ago

@gotcha how can we automate test ipdb without starting the interactive console?

MrMino commented 3 years ago

Shouldn't this land in IPython?

alexandrebarbaruiva commented 2 years ago

@gotcha stale PR?

gotcha commented 2 years ago

@alexandrebarbaruiva I have not worked on this for a while. Any help appreciated.

alexandrebarbaruiva commented 2 years ago

@gotcha under Python 3.9, IPython 8.3.0 and ipdb 0.13.9 there's already shared history between different sessions!

Probably came from IPython itself

gotcha commented 2 years ago

@alexandrebarbaruiva Thanks for documenting this.

MrMino commented 2 years ago

Yes, see #236. Shared history works across set_trace() calls, virtualenvs, %debug magic, and the python -m ipdb itself.

I believe the aforementioned issue and this PR can now be closed.