The Debug Adapter Protocol (DAP) implementation for the ipdb debugger.
Project description
ipdab
A Debug Adapter Protocol (DAP) for the Python pdb and ipdb debuggers. Debugpy is the reference implementation of a DAP for Python. The DAP allow your IDE to communicate with the debugger in a standardised way.
The good, old Python debuggers pdb and ipdb debugger were considered incompatible with the DAP as you control the debugger from the terminal, and not from your IDE.
The aim of ipdab is to implement the DAP to these debuggers to the extent possible, and get create a debugging experience that some would consider to have the best of both world:
- You control the debugger from the terminal
- Your IDE is able to track the debugger, e.g., by indicating the current line with an arrow.
How it works
In addition to starting the pdb or ipdb debugger, ipdab starts server whenever you use set_trace.
Any IDE that supports the DAP can connect to this server to track progress of the debugger, retrieve variable values,
retrieve the stack trace etc.
Note that it's not possible to control the debugger from your IDE. This is a technical limitation of the pdb and ipdb debugger.
They give control to the user every time you see a command prompt. At such a point, the DAP server cannot inject any commands
as it doesn't control the terminal in which the debugger runs. Controlling the debugger should be done from the terminal itself.
Installation
pip install ipdab
Or, clone the repository and install with:
pip install -e .
Usage
Just like ipdb, use ipdab in the code you want to debug:
print("Hello, world!")
print("Starting ipdab...")
import ipdab
ipdab.set_trace()
print("This will be debugged.")
Now, connect your IDE to the DAP server started by ipdab.
Neovim
In Neovim, this could work by adding an extry entry to your dap.adapters and dap.configurations:
local dap = require "dap"
-- Custom DAP adapter for ipdb
dap.adapters.ipdb = {
type = "server",
host = "127.0.0.1",
port = 9000,
}
-- Attach config — does not launch, just connects
dap.configurations.python = dap.configurations.python or {}
table.insert(dap.configurations.python, {
name = "Attach to ipdb",
type = "ipdb",
request = "launch", -- <-- important to say launch here!
program = "${file}",
justMyCode = false,
cwd = vim.fn.getcwd(),
})
Then, start your Python script any way you want, e,g., with python your_script.py or ipython -i your_script.py.
When the execution hits the ipdab.set_trace() line, the DAP server will start and you can connect to it from Neovim with :lua require'dap'.continue().
VS Code
Should work similar to Neovim, not tested yet.
TODO
-
Test on slower hardware
- It seems that dapuit is timing out
- Try to start it with fewer windows
-
Cleanup the repo
-
Create a Neovim plugin
-
Write a blog post about debugging
-
Connect pdb backend in addition to ipdb backend
-
Fix compatiblity with ipython 9.1.0 and higher, entering the debugger seems to break
-
Check how ipdab works with module reloads
-
Consider post mortem support
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ipdab-25.8.4.tar.gz.
File metadata
- Download URL: ipdab-25.8.4.tar.gz
- Upload date:
- Size: 13.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f65c810f5c803698bcc18b559ecd9dfb21866a0fce9a2b4f9b253e2b03cd91a7
|
|
| MD5 |
5d5003df1203729e01389de57bfc3de7
|
|
| BLAKE2b-256 |
e28b211c30711e9188a75b007b2553adff41fd260ca47170d00d3e25c11e70b6
|
Provenance
The following attestation bundles were made for ipdab-25.8.4.tar.gz:
Publisher:
python-publish.yml on mvds314/ipdab
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ipdab-25.8.4.tar.gz -
Subject digest:
f65c810f5c803698bcc18b559ecd9dfb21866a0fce9a2b4f9b253e2b03cd91a7 - Sigstore transparency entry: 454470203
- Sigstore integration time:
-
Permalink:
mvds314/ipdab@7d88aeb93d9374a45e140f018d9d18836fc7ae7f -
Branch / Tag:
refs/tags/25.8.4 - Owner: https://github.com/mvds314
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@7d88aeb93d9374a45e140f018d9d18836fc7ae7f -
Trigger Event:
push
-
Statement type:
File details
Details for the file ipdab-25.8.4-py3-none-any.whl.
File metadata
- Download URL: ipdab-25.8.4-py3-none-any.whl
- Upload date:
- Size: 13.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9465f2b907b7594b270170f429f4d0f89344dd080b94de0b02e5223d1df8f647
|
|
| MD5 |
2272cdb8dad3e4a1cade244644491086
|
|
| BLAKE2b-256 |
d6c90876844e3e6aaad83962c3443d7b3d27d1c4920841fd75eb1fed6a132454
|
Provenance
The following attestation bundles were made for ipdab-25.8.4-py3-none-any.whl:
Publisher:
python-publish.yml on mvds314/ipdab
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ipdab-25.8.4-py3-none-any.whl -
Subject digest:
9465f2b907b7594b270170f429f4d0f89344dd080b94de0b02e5223d1df8f647 - Sigstore transparency entry: 454470205
- Sigstore integration time:
-
Permalink:
mvds314/ipdab@7d88aeb93d9374a45e140f018d9d18836fc7ae7f -
Branch / Tag:
refs/tags/25.8.4 - Owner: https://github.com/mvds314
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@7d88aeb93d9374a45e140f018d9d18836fc7ae7f -
Trigger Event:
push
-
Statement type: