An extension for nvim-dap providing default configurations for python and methods to debug individual test methods or classes.
- Requires Neovim HEAD/nightly
- Requires nvim-dap
- Requires debugpy
- Requires a tree sitter parser for python. Install either via
:TSInstall pythonof nvim-treesitter or manually compile the parser from tree-sitter-python and copy it into.config/nvim/parser/. - Install like any other neovim plugin
It is recommended to install debugpy into a dedicated virtualenv. To do so:
mkdir .virtualenvs
cd .virtualenvs
python -m venv debugpy
debugpy/bin/python -m pip install debugpy- Call
setupin yourinit.vimto register the adapter and configurations:
lua require('dap-python').setup('~/.virtualenvs/debugpy/bin/python')The argument to setup is the path to the python installation which contains the debugpy module.
- Use nvim-dap as usual.
- Call
:lua require('dap').continue()to start debugging. - See
:help dap-mappingsand:help dap-api. - Use
:lua require('dap-python').test_methodto debug the closest method above the cursor.
Currently this only works with the unittest test framework. pytest and others are not supported yet.
- Use
:lua require('dap-python').test_classto debug the closest class above the cursor.
I'm looking for co-maintainers who are:
- Ensuring test runners like
pytestare supported as well. - Ensuring Windows is well supported