Open delucca opened 1 year ago
You don't have to poetry run
everything! Just activate the virtual environment yourself and run things directly.
@dimbleby I think you're mixing this issue with the other. For this issue I'm not using poetry run
(I've never said I was in this specific issue)
For this issue, even in a Poetry shell, the issue is the same. If I install the application with Poetry, Flask debugger doesnt work for some reason (with Nvim). If I install the same application without using Poetry (in a common venv) it works
To be 100% clear, in the Poetry shell the debugger is able to bootstrap, but setting breakpoints breaks the application for some reason.
all you have given us here is a link to another issue, in which the configuration shows that you are calling poetry run
program = "${env:PYTHON_VENV_PATH}/bin/poetry",
args = {
"run",
"flask",
"--no-debug",
"run",
},
if you're now saying that's not what you're doing then I don't even
@dimbleby as I've mentioned, the same thing happens if you open a shell instead of using poetry run
(as I've mentioned in the issue)
do you mean poetry shell
? I wouldn't do that either: just activate the virtual environment in the regular way and run things directly.
This report is too involved and too confused: if you can reduce it to something that reproduces without having to install neovim and dap and flask then you'll have a better chance of someone taking an interest in it.
@dimbleby you can use the same example from the original issue (on the last comment from the nvim-dap-python author)
I can create a github repo if you want, but essentially you just need to launch any simple Python application. Unfortunately I don't see any possible alternative of exploring this issue without having to install nvim
and nvim-dap
, since the issue is specifically a problem with debugging in that specific tool 😄
you've linked to a comment which says that "it works for me.". Plainly that is not a way to reproduce your problem.
I'm gonna duck out, this is going nowhere.
Maybe I'm being grumpy but I think this is good advice: you'll have a better chance of getting help from people if you make it as easy as possible for them. Links to complicated issues, with not very much information, and contradictory comments... are not that.
@dimbleby if you really wants to help and understand the problem, take some time to read the original issue.
It isn't a "it works for me" issue. It contains a minimal reproduction. You just need to duplicate that code on your machine and run it, with and without using Poetry
As I've mentioned, if you want I can create a repository to simplify, but it is just a single file, I don't see any point of creating a repo for that
I found a really nice way of doing this after banging my head on my desk over it.
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug: start",
"type": "debugpy",
"request": "launch",
"module": "poetry",
"args": [
"run",
"start"
],
"justMyCode": false
}
]
}
[virtualenvs]
in-project = true
And then the final touch is to run
poetry add --group dev poetry
which bootstraps poetry and enables its use with debugpy
without any of the extra headache of switching your environment, etc.
Do the instructions in https://github.com/python-poetry/poetry/pull/9708#issuecomment-2375769242 fix this issue?
If not, please provide clear instructions on how to reproduce, with sample code, configs, etc.
Poetry version: 1.4.0
Python version: 3.10
OS version and name: Arch Linux
[x] I am on the latest stable Poetry version, installed using a recommended method.
[x] I have searched the issues of this repo and believe that this is not a duplicate.
[x] I have consulted the FAQ and blog for any relevant entries or release notes.
[x] If an exception occurs when executing a command, I executed it again in debug mode (
-vvv
option) and have included the output below.Issue
Following up on this issue, for some reason nvim-dap is not being able to attach a debugger if I'm running an application using Poetry
If I run using Python directly it works, but using Poetry it automatically closes. If I run from within a Poetry shell, it bootstraps the debugger, but whenever I set breakpoints debugpy throws an error
You can see the details on the original issue.
To replicate the issue you just need to do the following:
Create the basic setup without Poetry:
Create a
vscode/launch.json
:Create
foo.py
:app = Flask(name)
@app.route("/") def hello(): return "
Hello World
"