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

Add support for IPython debugger to breakpoint #154

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 # type: ignore
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
Loading