-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Use 'conda run' when debugging user code #8422
Comments
To make this work,
OR
But it seems support for that has been deprecated in
as
|
Please ensure we re-use existing code instead of hardcoding logic in other places. |
If the current interpreter is not Conda, the extension should provide the full path to the corresponding Python binary in "python", just like it did before via "pythonPath". In the common case of a single value, it can be specified directly - i.e. But note that "python" is a ptvsd 5 thing, so none of this should kick in if the older version is in use - it should continue to use "pythonPath". |
@int19h Oh right. Edited the issue accordingly. |
Still unsure why we're documenting an existing logic. what if another is missed again. |
Oh I see what you're saying. |
Make sure that when we test this, we also test it with auto-activate terminal setting turned on. |
Shouldn't we use Else user output won't be displayed in terminal, |
@DonJayamanne this is for calling the debugger, not running python code |
But with the way debug adapter is designed, why do we even need to run the adapter with conda run! @int19h @karthiknadig /cc |
That's exactly what the proposal does: "python" is a property that gets parsed by the adapter; or rather by the launcher, which is spawned by the adapter via "runInTerminal" request to VSC. The launcher then applies it when spawning the debuggee. Neither the adapter nor the launcher run in the activated environment. Are you saying that the debuggee needs to be spawned using If we do, I'm not sure how we can pull that off. We'd need to issue |
Isn't that applicable only if users have that version? If not, something as simple as Also, when debugging apps like flask, or simple console apps users expect to see the output (see the port/address). Yes such output is displayed in the debug console as well. However when debugging we display the terminal as the default. Hence none of this information is displayed when using conda run. Hence user see nothing! I.e. today they see all the output, tomorrow with a new version, gone! 😄 Long story short, using
Agree. I believe we'll need to review the options, pros and cons and impact on UX. @luabud @karthiknadig @int19h |
@luabud Thanks, however the title seems to indicate this is for running user code. Or have i misunderstood your comment. |
@int19h @karthiknadig
Note:
I'll try to find the original issue in PVSC and VSC repo where this was captures. Previous discussions on this same solution (discussed with upstream VSC):
|
They can be done with two "runInTerminal" requests; the problem rather is that there's no way to wait for the first one to complete before issuing the second. But I don't think the extension can handle it any better. The fundamental problem is that activation is a separate command, and there's no way with the VSCode terminal API to determine when command finishes execution. And that's because they're basically just sending the command as terminal input, so there's no way to determine when shell starts and finishes executing it (or even if it does). So, the question rather is: how does the activation code knows that activation is complete, and it is safe to execute further commands? Having a way to execute two commands with a single API call / DAP request would be ideal here. The proposed workarounds in microsoft/vscode#67692 are not great - they effectively require us to reimplement all the shell-specific argument quoting that VSC already does for all supported shells. It would be much easier for them to accept multiple commands, using the existing quoting logic, and just adding |
VSCode can do this: I.e. chain the commands into one line. |
You can do this with I can't find any high-level terminal APIs that do shell-specific quoting - like |
To clarify, what I'd like to avoid is having to re-implement all of this: |
I agree, there's more to this (keeping track of terminals, etc). And that's something we wanted to avoid in core extension team (back when I was there). @brettcannon is aware of these discussions. |
@int19h Had a chat with @karthiknadig about an alternative. Creating a terminal with the right environment variables. This might help https://github.com/microsoft/vscode-python/issues/8928 |
Based on chats with the team:
With #20651 we're now using |
We're currently getting env variables using conda run and applying to debugging or executing #20651, which also has been working well. Hence closing as not required for now. |
And I assume this won't be a concern when debugging is launched from the Python Debugger extension or if people turn off the terminal activation feature? |
That's right, we intercept and add the env variables independently of the experiment. |
Work item associated to the spike #8421
The text was updated successfully, but these errors were encountered: