Skip to main content

pdbp (Pdb+): A drop-in replacement for pdb and pdbpp.

Project description

pypi is a proxy for installing pypi (Pdb+).


pdbp (Pdb+)

Pdb+ Advanced Python Console Debugger

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

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


Installation:

pip install pdbp

Then add import pdbp to an __init__.py of your project, which will automatically make Pdb+ the default debugger at breakpoints:

import pdbp

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

import pdbp  # noqa

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

PYTHONBREAKPOINT=pdbp.set_trace

Usage:

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

To trigger a breakpoint from a pure python run, use:

python -m pdbp <script.py>

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

(To learn more Pdb+ console commands, type help in the Pdb+ console and press Enter/Return.)


pdbp (Pdb+) makes improvements to pdbpp 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 typing n + Enter).

If you somehow reset pdb to Python's built-in version, you can always replace pdb with pdbp again as the default debugger by running this:

import pdb
import pdbp
for key in pdbp.__dict__.keys():
    pdb.__dict__[key] = pdbp.__dict__[key]

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

import pdb
if hasattr(pdb, "DefaultConfig"):
    pdb.DefaultConfig.filename_color = pdb.Color.fuchsia
    pdb.DefaultConfig.line_number_color = pdb.Color.turquoise
    pdb.DefaultConfig.truncate_long_lines = False
    pdb.DefaultConfig.sticky_by_default = True

You can also trigger Pdb+ activation like this:

import pdbp
pdbp.set_trace()

pdbp (Pdb+) commands:

Pdb+ commands

Post Mortem Debug Mode:

Pdb+ Post Mortem Debug Mode

The where / 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 typing sticky in the Pdb+ console prompt and pressing Enter/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 as seleniumbase:


Pdb+ Advanced Python Console Debugger

(Pdb+ is maintained by the SeleniumBase Dev Team)

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pdbplus-1.6.1.tar.gz (10.1 kB view details)

Uploaded Source

Built Distribution

pdbplus-1.6.1-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

Details for the file pdbplus-1.6.1.tar.gz.

File metadata

  • Download URL: pdbplus-1.6.1.tar.gz
  • Upload date:
  • Size: 10.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.9

File hashes

Hashes for pdbplus-1.6.1.tar.gz
Algorithm Hash digest
SHA256 fc58db528f56597d02399622b4539304ca7804a192475635f506e8b7adab0b09
MD5 ed2d5c792dd6f03a4946318023c36374
BLAKE2b-256 7c18327b0623e95ea6eff4d9e98212626c5beac7edfaf32d372f4be8896da11b

See more details on using hashes here.

File details

Details for the file pdbplus-1.6.1-py3-none-any.whl.

File metadata

  • Download URL: pdbplus-1.6.1-py3-none-any.whl
  • Upload date:
  • Size: 8.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.9

File hashes

Hashes for pdbplus-1.6.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f9fc8eeb0f08ecab9a25914110dd92868890d9eedc8339b237fc7f9a0419bb88
MD5 ac2fc8a1d739e2a7da45f649a1ab96a4
BLAKE2b-256 e3a701263f9dea9487e311a08ac9f28a6f396a7d1494f835249f59b60ee4d308

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page