-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs: How to debug your main script from VS Code #9708
base: main
Are you sure you want to change the base?
docs: How to debug your main script from VS Code #9708
Conversation
I do not think we should recommend adding poetry to the dev dependencies of the project because this can lead to unexpected behavior. I am not a VS Code user, but I assume you can just configure the correct interpreter (the one returned by |
This is one of the multiple things I tried. Since I found some threads in StackOverflow (this one is just an example) about how to get VS Code debug working for a project managed with I can understand that it is not neither an elegant or robust solution and I'm very happy to document a more elegant method :-) |
Poetry installs the package into the virtual environment in editable mode (except for when you set |
The documentation states that package mode is the default behavior. This is true for my project; however, unless I install poetry as a development dependency, I encounter a 'Module not found' error, and I can't get debugging to work in VS Code. Clearly, my assumption about the reason for the module not being found was incorrect. What could be then the reason for the debugger to not find the error? |
Thanks @TheSven73 , with your I've updated my pull request with your instructions. |
Not sure either, hard to tell without a reproducible description of your attempt(s) (config+code). |
Drive-by question: if we were to include that in docs, what about other editors? Why should we have a special treatment for VS Code? |
From my point of view, this is not giving a special treatment to VS Code. When I found myself in need to debug a project managed with Poetry, setting it up in VS Code was not as straight forward as it is for projects not managed with Poetry. After searching for "how to do it" I found more people straggled with this, proposing different alternatives. After I succeeded, and given that more people struggled with this, I thought would be worth to share the "how to" together with poetry's documentation. |
I'm not convinced we have a clear definition yet of the problem we're trying to solve. I just tried the official Microsoft tutorial to debug Flask and it works like a charm with Poetry. The only difference is that the developer must point vscode to the venv created by poetry, instead of hand-rolling their own using Can someone in the linked issue(s) can provide a clear and reproducible problem statement? Other than: "must tell the user to point vscode to the poetry venv", because that's true for other editors as well. |
Resolves: #7592
After having some difficulties to debug the main script of my program while using VS Code, I found this answer that helped me to solve my issue. I thought that would be worth for others to have this piece of information within Poetry's documentation.