How could I set up a configuration to debug a package?
DoctorDalek1963 opened this issue · comments
I'm developing a Python package and would like to be able to run debugpy
with this package, and debug it from within nvim, but I don't know how to do that.
I've got the package installed in a virtual environment (in editable mode) and can run it with python -m package_name
. In PyCharm, I can set breakpoints in a file, run the package_name
module, and debug from the breakpoints.
I don't know how to use debugpy
, but I assume this is possible, and would love an example configuration for this behaviour. Thanks :)
If you want to debug a module instead of a file you'd use a configuration like this:
table.insert(require('dap').configurations.python, {
type = 'python',
request = 'launch',
name = 'My custom launch configuration',
module = 'module_name', -- 💀 change this to your module name
})
See https://github.com/microsoft/debugpy/wiki/Debug-configuration-settings and https://github.com/mfussenegger/nvim-dap-python#custom-configuration