Giter Site home page Giter Site logo

Comments (5)

disrupted avatar disrupted commented on May 29, 2024 2

I got it to work by following your comment on Django #7 (comment)

  1. Instead of running uvicorn directly, I am calling main.py which has
import uvicorn

if __name__ == "__main__":
    uvicorn.run(app, host="0.0.0.0", port=8000)
  1. install debugpy inside the project virtualenv

for me that is

poetry run pip install -U debugpy
  1. launch application using debugpy
python -m debugpy --listen 5678 --wait-for-client main.py
  1. inside Neovim start nvim-dap and use Attach remote configuration, when asked continue with default server host and port

alternatively, I also had success with this configuration:

table.insert(dap.configurations.python, {
    type = 'python',
    request = 'launch',
    name = 'FastAPI',
    program = vim.fn.getcwd() .. '/main.py',
    pythonPath = function()
        return 'python'
    end,
})

then the application runs in a terminal window inside Neovim

from nvim-dap-python.

mfussenegger avatar mfussenegger commented on May 29, 2024 1

Started work on this in #21

from nvim-dap-python.

mfussenegger avatar mfussenegger commented on May 29, 2024

Looks like debugpy is trying to use an extension to the debug adapter protocol.

The debugpyAttach event is not part of the core protocol.
According to their wiki this event is generated when the debugger detects a subprocess.

This might be something for nvim-dap-python as I'm not going to merge debug adapter specific extensions to nvim-dap, and nvim-dap extensions have the possibility to handle custom events.

What's a bit problematic is that it is not documented how the client is supposed to handle these custom events.

from nvim-dap-python.

kasfil avatar kasfil commented on May 29, 2024

Thank you, i'll close this issue and reopen in nvim-dap-python.

from nvim-dap-python.

mfussenegger avatar mfussenegger commented on May 29, 2024

This should now be working with a debugpy version installed from git and with latest nvim-dap master.

(If it doesn't, please comment with a minimal reproduction so I can re-open and look into it)

from nvim-dap-python.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.