How to programmatically get active Python interpreter/version?

Hi folks,

I’m trying to pass the currently active Python interpreter’s path from the front-end to a Theia extension.

I am using ms-python 2020.5.86806 and vscode-builtin-python 1.48.2 with theia@ 1.5.0. I can select an interpreter from the bottom-left part of the screen and it is the path of the currently active interpreter, as seen there, that I want to pass to the backend.

image

Is there a way to get this programmatically?

Thanks!

You need to check whether exposed as API or a command by the python extension.