Skip to main content

Pdb with Rich library.

Project description

pdbr

PyPI version Python Version

pdbr is intended to make the PDB results more colorful. it uses Rich library to carry out that.

Installing

Install with pip or your favorite PyPi package manager.

pip install pdbr

Breakpoint

In order to use breakpoint(), set PYTHONBREAKPOINT with "pdbr.set_trace"

import os

os.environ["PYTHONBREAKPOINT"] = "pdbr.set_trace"

or just import pdbr

import pdbr

New commands

vars(v)

it is used to get the local variables list.

inspect(i) / inspectall(ia)

In order to use rich.inspect as commands.

Config

Style

In order to use Rich's traceback, style, and theme, set setup.cfg.

[pdbr]
style = yellow
use_traceback = True
theme = friendly

History

store_history setting is used to keep and reload history, even the prompt is closed and opened again.

[pdbr]
...
store_history=.pdbr_history

Celery

In order to use Celery remote debugger with pdbr, use celery_set_trace as below sample. For more information see the Celery user guide.

from celery import Celery

app = Celery('tasks', broker='pyamqp://guest@localhost//')

@app.task
def add(x, y):
    
    import pdbr; pdbr.celery_set_trace()
    
    return x + y

Vscode user snippet

To create or edit your own snippets, select User Snippets under File > Preferences (Code > Preferences on macOS), and then select python.json.

Place the below snippet in json file for pdbr.

{
  ...
  "pdbr": {
        "prefix": "pdbr",
        "body": "import pdbr; pdbr.set_trace()",
        "description": "Code snippet for pdbr debug"
    },
}

For Celery debug.

{
  ...
  "rdbr": {
        "prefix": "rdbr",
        "body": "import pdbr; pdbr.celery_set_trace()",
        "description": "Code snippet for Celery pdbr debug"
    },
}

Samples

Traceback

Project details


Download files

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

Source Distribution

pdbr-0.3.2.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

pdbr-0.3.2-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file pdbr-0.3.2.tar.gz.

File metadata

  • Download URL: pdbr-0.3.2.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.1 CPython/3.6.12 Linux/5.4.0-1025-azure

File hashes

Hashes for pdbr-0.3.2.tar.gz
Algorithm Hash digest
SHA256 e30f863895d9b56037d9a9a9d237de04af6c44abcb9062be3fdf6531fff4441a
MD5 40e4a8a4b92762c2dc229d3efb22d196
BLAKE2b-256 1a8355689faf1cbc5f1d4a1dd821f7a97a0c3fdf4ac523f34a97564be952efa7

See more details on using hashes here.

File details

Details for the file pdbr-0.3.2-py3-none-any.whl.

File metadata

  • Download URL: pdbr-0.3.2-py3-none-any.whl
  • Upload date:
  • Size: 5.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.1 CPython/3.6.12 Linux/5.4.0-1025-azure

File hashes

Hashes for pdbr-0.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a555b776806bdab7daf38434ce279055d1cabcec716e480c0c03b799f15a30b4
MD5 e4832ad87a6d0512a8989f52896a87a9
BLAKE2b-256 914ec160b9af9fe9dcc2f1eebf6b4df0a82e1f29a089bb004516afea9cad70da

See more details on using hashes here.

Supported by

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