Reverse remote debugging with pdb
Allows remote debugging with pdb (Python built-in debugger) by reverse and direct connections to tools like netcat and socat.
Inspired by: https://pypi.org/project/rpdb/
Installation
pip install reverse_pdb
Usage:
Remote reverse debugging
- Given this snippet to be debug with pdb
def add_numbers(a, b):
return a + b
result = add_numbers(3, 5)
breakpoint()
print("The sum is:", result)
- Add the following changes
from reverse_pdb import remote_pdb_reverse
def add_numbers(a, b):
return a + b
result = add_numbers(3, 5)
rdb = remote_pdb_reverse("127.0.0.1", 4444)
rdb.set_trace()
print("The sum is:", result)
- Run a netcat listener
nc -vlp 4444
- Run your code and interact with pdb from the netcat session
Remote "direct" debugging
- Add these changes
from reverse_pdb import remote_pdb
def add_numbers(a, b):
return a + b
result = add_numbers(3, 5)
rdb = remote_pdb("127.0.0.1", 4444)
rdb.set_trace()
print("The sum is:", result)
- Run a netcat client
nc -v localhost 4444
- Run your code and interact with pdb from the netcat session
Note:
In the above examples the loopback (127.0.0.1) is used for simplicity, however, any IP/hostname is also valid.
Uses cases
Remote debugging from:
- Behind a firewall/NAT
- Airflow tasks
- Sealed environments like AWS MWAA (AWS managed Airflow)
Author
Ulises ulises.odysseus22@gmail.com
Release files for reverse-pdb 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| reverse_pdb-0.0.1.tar.gz | 2.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| reverse_pdb-0.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 5.4 kB
Release files / reverse_pdb-0.0.1.tar.gz
| Download URL | reverse_pdb-0.0.1.tar.gz |
|---|---|
| Size | 2.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9e629ce9594a84ebbd61a84403c1965684c738b671113535dd308904b116e486
|
|
BLAKE2b-256 checksum How to use checksums |
088c761ac5604ad0aa74cda0ea48f13dc8085759e2f26258a6999bd85da99f50
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.17
|
Release files / reverse_pdb-0.0.1-py3-none-any.whl
| Download URL | reverse_pdb-0.0.1-py3-none-any.whl |
|---|---|
| Size | 2.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
726a6eaf92b5eeb4c0ea26497b168d66c804f6b7302858c3595356cb0a3ce781
|
|
BLAKE2b-256 checksum How to use checksums |
21187f738084d04525a3a9ecab989bced564c271f71989dc0312967423b3934c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.17
|