Python debuging

I cant figure out how to enable python debuging in Theia.

Can anyone point me in direction on where to start, what to read etc ?

[original thread by Andreas Lorensen]

[Anatoliy Bazko]

For the time being there is no pyhton debugging support in Theia.
I’ve tried to deploy vscode extension as plugin by id vscode:extension/ms-python.python but faced unexpected error:

root ERROR [hosted-plugin: 9232] (node:9232) UnhandledPromiseRejectionWarning: TypeError: Expected a string, got undefined
    at e.exports.e (/tmp/vscode-unpacked/vscode_extension_ms_python_python.vsix/extension/out/client/extension.js:1:179761)
    at f (/tmp/vscode-unpacked/vscode_extension_ms_python_python.vsix/extension/out/client/extension.js:1:49934)
    at p.update (/tmp/vscode-unpacked/vscode_extension_ms_python_python.vsix/extension/out/client/extension.js:1:43545)
    at p.initialize (/tmp/vscode-unpacked/vscode_extension_ms_python_python.vsix/extension/out/client/extension.js:1:49898)
    at new p (/tmp/vscode-unpacked/vscode_extension_ms_python_python.vsix/extension/out/client/extension.js:1:42344)
    at Function.getInstance (/tmp/vscode-unpacked/vscode_extension_ms_python_python.vsix/extension/out/client/extension.js:1:42473)
    at c.getSettings (/tmp/vscode-unpacked/vscode_extension_ms_python_python.vsix/extension/out/client/extension.js:83:355447)
    at v.initialize (/tmp/vscode-unpacked/vscode_extension_ms_python_python.vsix/extension/out/client/extension.js:83:516978)
    at /tmp/vscode-unpacked/vscode_extension_ms_python_python.vsix/extension/out/client/extension.js:9:67557
    at /tmp/vscode-unpacked/vscode_extension_ms_python_python.vsix/extension/out/client/extension.js:9:68043

@anlo you can follow this issue:

if you would like to help

you can test VS Code python extension yourself following along

looking into them also very welcomed :slight_smile:

[Simas Joneliunas]

I am also interested in contributing to this extension. I am currently familiarizing myself with theia project structure. @anlo if you are thinking of working on the extension, maybe we can join our efforts?

[Simas Joneliunas]

Update on this topic: I went for a more hacky approach for now, and i have imported vs-python extension in a similar way that java-debug extension is currently being used.

It is not pretty by any means as this means we have pyls for language highlighting and vs-python for debugging, but … i think it would take me way more time for me to get to know the source code well enough to dabble with the #3815 than this extension took me to create :slight_smile:

I need to do more testing to make sure the features that i need are working (i.e. solve the debug terminal being killed on session termination), but i think this solution will be sufficient for now until official VS extension support will become more reliable.

Its not published in the NPM yet, so it has to be build from source. I plan to publish it in a few days after more testing.

[Andreas Lorensen]

I would like to join our efforts, but I am not any good t extension making :frowning: But testing, trying, and learning I do way to much :wink: As soon as you publish to npm I will try and see what I can figure out.

[Simas Joneliunas]

I published it under You can try it out!

[Andreas Lorensen]

OK so for testing I have to include the extension in my theia. And also need to have vs-python extension installed Ill guess. And then add the python debug attributes. As I mentioned I am not tht good at this stuff, but I think I can mange to add your work to the package.json and build theia and instll the vs-python plugin. So hopefully I can test and learn and If I figure something out Ill get bck on it - or fi I get into trouble :slight_smile:

[Simas Joneliunas]

you have to install the extension, for sure. The extension should, however, download vs-python by itself and handle the rest of the setup for you. Thus the steps to launch it would be:

  1. add the extension (“python-debug”: “1.0.0”,) to package.json (make sure to use “^0.3.19” version lock for the theia dependencies, as “latest” will break the ide due to the extension internally referencing theia major version dependencies).
  2. Follow the theia debug documentation to build the ide and add debug configurations
  3. modify default launch configuration by setting “console”: “none” in the debug configuration.
  4. enjoy.

[Andreas Lorensen]

Trying and trying, but are missing some thing. Where to find theia debug documentation and/or where to add the python debug configurations ?

[Simas Joneliunas]

I attached a few images below showing how you create a new debug configuration (the images are mostly miroring theia debug documentation). The (almost) full python debug settings list can be found in the readme file of my repo ( or in vs-python extension’s documentation.

You can aso use theia’s “Add Debug Configuration” function to try various default python debug configurations (console, flask, django etc), to see how they are set up.

How to create new python debug configuration:


    3.2.* (recommended)

*For console, right now you have 2 options. [3.1.]“internalTerminal”/“externalTerminal” will spawn a new console for the debug process, but it will be terminated after debug session is closed (either successfully or due to an exception). Meanwhile [3.2.] “none”, which is a recommended approach for now, will instead print out all debug logs to the theia’s degub console.