vscode debug setting in launch.json with custom executable inside pipenv

Viewed 1308

Hello I'm working with pipenv which have a differetn path for every developer, but I want to have the same launch setting for all. The problem is that the program is not the python is a custom executable with is under the virtual environment bin folder. Here is my current launch.json

{
     "name": "Python: TEST",
     "type": "python",
     "request": "launch",
     "stopOnEntry": false,
     "console": "integratedTerminal",
     "program": "${env:HOME}/.local/share/virtualenvs/venv-PbRe8Lzd/bin/<program>",
     "args": [
              ...
             ],
     "cwd": "${workspaceRoot}",
}

And for me works OK becaouse my is under "venv-PbRe8Lzd/bin/" but for the other developers that have different venv folder no. Any Idea on how to do this generic for all?

1 Answers

I think better not to sync .vscode folder at all. But anyway it's possible to put interpreter path into another file ".vscode/settings.json".

  1. Delete "program" from launch.json.
  2. Install the Python extension for Visual Studio Code https://github.com/Microsoft/vscode-python (probably it's already installed)
  3. Press Ctrl+Shift+P
  4. Search "Python: Select Interpreter"
  5. Select pipenv interpreter path

or

  1. Create/modify file ".vscode/settings.json"
{
    "python.pythonPath": "${env:HOME}/.local/share/virtualenvs/venv-PbRe8Lzd/bin/python"
}
Related