pdb-attach
A python debugger that can attach to running processes.
What it is and what it does
pdb-attach is a remote debugger that lets you pause and inspect a long-running Python process without stopping it. You set it up by importing the module and calling `listen()` with a port number in your application code; when the process is running, you connect from another terminal using the process ID and port, and interact with pdb as usual. When done, you detach and the process continues.
The package uses signals and sockets to communicate between the debugger and the running process. It is POSIX-only (no Windows support) and requires that you instrument your code with pdb-attach before the process starts—you cannot attach to an arbitrary running Python process. The documentation warns that the socket is unauthenticated, so a local attacker could potentially connect and execute code as your user; planned features aim to mitigate this, but they are not yet implemented.
Use it for:
- Debug a long-running batch job or service without restarting it to see what state it is in.
- Inspect variables and execution flow in a production-like environment while the process continues running.
- Troubleshoot deadlocks or hangs in multi-threaded or async code by pausing and examining the call stack.
- Develop and test a daemon or background worker by attaching a debugger on demand without stopping the service.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Attaches a Python debugger (pdb) to long-running processes without restarting them, allowing interactive inspection and control via a socket connection.
Yes, if you are on POSIX and willing to instrument your code with pdb-attach before deployment. It solves a real problem—interactive debugging of long-running processes—that standard pdb cannot handle. The dormant maintenance status and lack of active security mitigations are acceptable for development and testing environments, but the unauthenticated socket and Windows incompatibility limit its scope. Install if you need remote debugging for a POSIX-based service or batch job.
Install
pdb-attach on PyPI
pip
pip install pdb-attachuv
uv add pdb-attachpoetry
poetry add pdb-attachInstalling pdb-attach
Before you install
Low friction installation with no runtime dependencies. Maintenance is dormant—last release was 2023-09-23—but the repository remains active and unarchived. Suitable for projects that do not require active upstream support.
License in practice
BSD 3-Clause is permissive and poses no significant restrictions on use, modification, or distribution. Safe for both open-source and proprietary projects.
Quickstart
# In your running process:
import pdb_attach
pdb_attach.listen(50000)
# From another terminal, attach to the process:
python -m pdb_attach <pid> 50000
# Then interact with pdb normally; type 'detach' to disconnect.
POSIX-only; does not work on Windows. Must be imported and configured in the target process before it starts—cannot attach to an already-running process that did not import pdb-attach.
Verify before relying
- Whether the package works reliably on Python versions beyond 3.9 given the last release was 2023-09-23.
- Whether the planned security mitigations (secret-key signing, read-only inspection mode) have been implemented since the documentation was written.
Package facts
| License | BSD 3-Clause (permissive) |
| Python support | supports the current Python release (>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, <4) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | dormant — 1,056 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 700,571/month — #5,293 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pdb_attach-3.0.1-py3-none-any.whl
Keywords: pdb, debug, debugger, process
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
web-pdbWeb-PDB provides a web browser interface for…
permissive · top 15,000 on PyPI
manholeManhole installs an in-process debugging…
permissive · top 5,000 on PyPI
debugpydebugpy is a Debug Adapter Protocol…
permissive · top 1,000 on PyPI
remote-pdbExposes Python's debugger (pdb) over a TCP…
permissive · top 5,000 on PyPI
rpdbrpdb is a remote debugger that wraps Python's…
unclear · top 15,000 on PyPI
pdbpppdbpp is a drop-in replacement for Python's…
permissive · top 5,000 on PyPI
google-python-cloud-debuggerAttaches a snapshot debugger agent to Python…
permissive · top 15,000 on PyPI
pydevdpydevd is a Python debugger backend that…
copyleft · top 5,000 on PyPI
pdbppdbp is an enhanced Python debugger that…
permissive · top 5,000 on PyPI
pydevd-pycharmPyCharm's debugger backend for remote debugging…
permissive · top 15,000 on PyPI