Skip to content

Commit 261ce64

Browse files
committed
Support debugpy-adapter executable in setup
1 parent 3428282 commit 261ce64

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,10 @@ To install the python tree-sitter parser you can either:
7979
-- must work in the shell
8080
```
8181

82+
Newer versions of `debugpy` also include a `debugpy-adapter` executable
83+
which you can use in place of the `python` executable.
84+
85+
8286
If using [uv][uv]:
8387

8488
```lua

lua/dap-python.lua

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ end
208208

209209
--- Register the python debug adapter
210210
---
211-
---@param python_path "python"|"python3"|"uv"|string|nil Path to python interpreter. Must be in $PATH or an absolute path and needs to have the debugpy package installed. Defaults to `python3`.
211+
---@param python_path "python"|"python3"|"uv"|"debugpy-adapter"|string|nil Path to python interpreter. Must be in $PATH or an absolute path and needs to have the debugpy package installed. Defaults to `python3`.
212212
--- If `uv` then debugpy is launched via `uv run`
213213
---@param opts? dap-python.setup.opts See |dap-python.setup.opts|
214214
function M.setup(python_path, opts)
@@ -236,16 +236,27 @@ function M.setup(python_path, opts)
236236
else
237237
---@type dap.ExecutableAdapter
238238
local adapter
239-
if python_path == "uv" then
239+
local basename = vim.fn.fnamemodify(python_path, ":t")
240+
if basename == "uv" then
240241
adapter = {
241242
type = "executable",
242-
command = "uv",
243+
command = python_path,
243244
args = {"run", "--with", "debugpy", "python", "-m", "debugpy.adapter"},
244245
enrich_config = enrich_config,
245246
options = {
246247
source_filetype = "python"
247248
}
248249
}
250+
elseif basename == "debugpy-adapter" then
251+
adapter = {
252+
type = "executable",
253+
command = python_path,
254+
args = {},
255+
enrich_config = enrich_config,
256+
options = {
257+
source_filetype = "python"
258+
}
259+
}
249260
else
250261
adapter = {
251262
type = "executable",

0 commit comments

Comments
 (0)