Improve interpreter selection on different platforms#517
Improve interpreter selection on different platforms#517MikhailArkhipov merged 55 commits intomicrosoft:masterfrom MikhailArkhipov:inst1
Conversation
| await this.executeAndOutput('brew', ['install', 'python']); | ||
| } | ||
| } | ||
|
|
There was a problem hiding this comment.
I think it should be like Windows then
There was a problem hiding this comment.
I think linux too has a version of Python pre-installed. @brettcannon Do you think we should support the system python in linux?
There was a problem hiding this comment.
Or we can leave Linux alone and let users figure it out?
| return this._isMac; | ||
| } | ||
| public get isLinux(): boolean { | ||
| return !(this.isWindows || this.isLinux); |
There was a problem hiding this comment.
Isn't the condition supposed to be return !(this.isWindows || this.isMac);
src/test/index.ts
Outdated
| timeout: 25000, | ||
| retries: 3 | ||
| retries: 3, | ||
| grep: 'Signatures' |
src/client/extension.ts
Outdated
|
|
||
| const pythonInstaller = new PythonInstaller(serviceContainer); | ||
| const passed = await pythonInstaller.checkPythonInstallation(); | ||
| const passed = await pythonInstaller.checkPythonInstallation(PythonSettings.getInstance()); |
There was a problem hiding this comment.
On second thought this might not be the best approach.
Users will now get bombarded with messages every time they open a python file in a new workspace.
Previously we'd display a warning on the bottom status bar. This change causes the display of a message every time you open a new workspace.
E.g. people using VS Code for scripting purposes or the like would now see this message every time, and we'd end up with the same issue we had with the linter. The solution was to add an option to stop showing the message ever again.
There was a problem hiding this comment.
My suggestion is to perform this check when installing a linter or something similar. I.e. at a point in time when the user has been presented with some UI (e.g. selecting an interperter, setting up tests, installing linter, etc from the extension)
src/test/index.ts
Outdated
| timeout: 25000, | ||
| retries: 3, | ||
| grep: 'Signatures' | ||
| grep: 'Installation' |
| if (await this.shell.showErrorMessage('Python that comes with MacOS is not supported. Would you like to install regular Python now?', 'Yes', 'No') === 'Yes') { | ||
| const brewInstalled = await this.ensureBrew(); | ||
| if (!brewInstalled) { | ||
| await this.shell.showErrorMessage('Unable to install Brew package manager'); |
There was a problem hiding this comment.
How about including instructions for the user to install Brew package manager. E.g.
Unable to install Brew package manager, please install Brew package manager and try again
| if (failed) { | ||
| resolve(false); | ||
| } | ||
| if (isTestExecution()) { |
There was a problem hiding this comment.
Wouldn't it be better to mock the process, without having to add conditional test code. Feels a little dirty and I'm afraid we'd end up writing a lot more of this.
There was a problem hiding this comment.
Yeah. I tried that but mocking of events is pretty convoluted. Basically something needs to emit exit asynchronously while test is running.
| constructor( @inject(IServiceContainer) private platformService: IPlatformService) { } | ||
|
|
||
| public get directorySeparatorChar(): string { | ||
| return this.platformService.isWindows ? '\\' : '/'; |
| } | ||
|
|
||
| public existsAsync(filePath: string): Promise<boolean> { | ||
| return new Promise<boolean>(resolve => { |
There was a problem hiding this comment.
Please use fs.pathExists (use import * as fs from 'fs-extra').
As a suggestion, wouldn't it be better to have fileExists and directoryExists.
I have a need for this (have already create similar methods in another PR, where I want to differentiate between files and directories)
There was a problem hiding this comment.
Sure, I can add dir/file separately. We can add more as we go. I didn't want to add all possible combos.
| } | ||
|
|
||
| public createDirectoryAsync(directoryPath: string): Promise<boolean> { | ||
| return new Promise<boolean>(resolve => { |
There was a problem hiding this comment.
you can use fs.mkdirp. I wouldn't swallow the exceptions, just use return fs.mkdirp(directoryPath)
| await this.executeAndOutput('brew', ['install', 'python']); | ||
| } | ||
| } | ||
|
|
There was a problem hiding this comment.
I think linux too has a version of Python pre-installed. @brettcannon Do you think we should support the system python in linux?
src/client/extension.ts
Outdated
| const interpreterManager = new InterpreterManager(serviceContainer); | ||
|
|
||
| const pythonInstaller = new PythonInstaller(serviceContainer); | ||
| const passed = await pythonInstaller.checkPythonInstallation(PythonSettings.getInstance()); |
There was a problem hiding this comment.
I don't think this is a good idea. Every time a Mac user opens a workspace or a python file in a new workspace, they have the potential of being hammered with a message. This could end up being an annoying message we had with the linters, the solution to which was to hide the message permanently.
Currently we display a warning in the status bar if the instance of python is invalid (none selected). Personally i prefer that (having learnt the lesson from the linter message). We could display a message when the user tries to install a linter, or setup unit tests or similar.
There was a problem hiding this comment.
I'd say this is where @qubitron would have to get involved as this is sort of a UX thing and we've had problems in the past (annoying linter messages) which was conveyed in the survey.
There was a problem hiding this comment.
Add Don't show this again?
There was a problem hiding this comment.
I'd wait for @qubitron to comment on this.
src/test/index.ts
Outdated
| timeout: 25000, | ||
| retries: 3 | ||
| retries: 3, | ||
| grep: 'Installation' |
Preliminary , working on tests