Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

pdbp (Pdb+): A drop-in replacement for pdb and pdbpp. To replace "pdb", add "import pdbp" to an "__init__.py" file.

License

NotificationsYou must be signed in to change notification settings

mdmintz/pdbp

Pdb+ Advanced Python Console Debugger

pdbp (Pdb+) is an advanced console debugger for Python. It can be used as a drop-in replacement forpdb andpdbpp.

pdbp (Pdb+) makes Python debugging a lot easier (and more fun!)


Installation:

pip install pdbp

Then addimport pdbp to an__init__.py of your project, which will automatically makePdb+ the default debugger at breakpoints:

importpdbp

(If usingflake8 for code-linting, you may want to add# noqa to that line):

importpdbp# noqa

You can also makepdbp the default debugger by setting an environmental variable:

PYTHONBREAKPOINT=pdbp.set_trace

Usage:

To trigger a breakpoint in your code withpytest, add--trace (to start tests with a breakpoint) or--pdb (to trigger a breakpoint if a test fails).

To trigger a breakpoint from a purepython run, use:

python -m pdbp<script.py>

BasicPdb+ console commands:n,c,s,u,d =>next,continue,step,up,down

(To learn morePdb+ console commands, typehelp in thePdb+ console and pressEnter/Return.)


pdbp (Pdb+) makes improvements topdbpp so that it works in all environments. It also includes other bug-fixes. "Sticky" mode is the default option, which shows multiple lines of code while letting you see where you're going (while typingn +Enter).

If you somehow resetpdb to Python's built-in version, you can always replacepdb withpdbp again as the default debugger by running this:

importpdbimportpdbpforkeyinpdbp.__dict__.keys():pdb.__dict__[key]=pdbp.__dict__[key]

Here's how to customizepdbp/pdb options if you don't like the default settings: (Shown below are the default settings.)

importpdbifhasattr(pdb,"DefaultConfig"):pdb.DefaultConfig.filename_color=pdb.Color.fuchsiapdb.DefaultConfig.line_number_color=pdb.Color.turquoisepdb.DefaultConfig.truncate_long_lines=Falsepdb.DefaultConfig.sticky_by_default=True

You can also triggerPdb+ activation like this:

importpdbppdbp.set_trace()

pdbp (Pdb+) commands:

Pdb+ commands

Post Mortem Debug Mode:

Pdb+ Post Mortem Debug Mode

Thewhere /w command, which displays the current stack:

Example of the 'where' command


Sticky Mode vs Non-Sticky Mode:

The default mode (sticky) lets you see a lot more lines of code from the debugger when active. In Non-Sticky mode, only one line of code is shown at a time. You can switch between the two modes by typingsticky in thePdb+ console prompt and pressingEnter/Return.

Sticky Mode:

Pdb+ Stick Mode

Non-Sticky Mode:

Pdb+ Non-Sticky Mode


Tab completion:

Pdb+ Tab Completion


Multi-layer highlighting in the same stack:

Pdb+ Advanced Python Console Debugger

More examples:

Pdb+ is used by packages such asseleniumbase:


Pdb+ Advanced Python Console Debugger


(Pdb+ is maintained by theSeleniumBase Dev Team)

About

pdbp (Pdb+): A drop-in replacement for pdb and pdbpp. To replace "pdb", add "import pdbp" to an "__init__.py" file.

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp