Python child process from Theia backend

Hello,

This a pretty open-ended question, I have created multiple extensions which spawn Python child processes in the backend. These use the following in default-server.ts:

var spawn = cp.spawn;
var process = spawn('python', #more_code_here);

The issue is that different systems might have different default Python versions which contain the libraries the child process requires to complete the process. So how does one approach this problem? Python paths can be directly inputted in place of the ‘python’, but whats to say any user has that folder in that path/the path also contains the version of Python which contains the libraries the child process needs?

Thanks for your help!

@kaustav-aarish thank you for the question, unfortunately I do not believe it is related/specific to the Theia framework. If the aim of your extension is to provide compatibility with multiple versions of Python, then likely the best approach would be to implement a solution which is the most generic and compatible without newer Python features. If you truly have different implementations per Python version then one approach is determining the end-user’s Python version (such as through a new preference) and calling the appropriate handlers.