Skip to content

Commit

Permalink
Add support for IPython debugger to breakpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
kinuax committed May 18, 2024
1 parent 2aea99d commit b8ce2cf
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions devtools/debug.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,14 @@ def format(self, *args: 'Any', frame_depth_: int = 2, **kwargs: 'Any') -> DebugO
return self._process(args, kwargs, frame_depth_)

def breakpoint(self) -> None:
import pdb

pdb.Pdb(skip=['devtools.*']).set_trace()
"""
Launch IPython debugger if installed. Otherwise, launch pdb.
"""
try:
from IPython.terminal.debugger import TerminalPdb as Pdb
except ImportError:
from pdb import Pdb
Pdb(skip=['devtools.*']).set_trace()

def timer(self, name: 'Optional[str]' = None, *, verbose: bool = True, file: 'Any' = None, dp: int = 3) -> Timer:
return Timer(name=name, verbose=verbose, file=file, dp=dp)
Expand Down

0 comments on commit b8ce2cf

Please sign in to comment.