FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Improve interpreter selection on different platforms by MikhailArkhipov · Pull Request #517 · microsoft/vscode-python · GitHub

Improve interpreter selection on different platforms - #517

Merged
Mikhail Arkhipov (MikhailArkhipov) merged 55 commits into
microsoft:masterfrom
MikhailArkhipov:inst1
Jan 4, 2018
Merged

Improve interpreter selection on different platforms#517
Mikhail Arkhipov (MikhailArkhipov) merged 55 commits into
microsoft:masterfrom
MikhailArkhipov:inst1

Conversation

Copy link
Copy Markdown

Preliminary , working on tests

  • Open Python installation page on Windows if Python is missing
  • Exclude default Apple Python on Mac
  • Install HomeBrew and Python on Mac if only system Python is present
  • Improve user messaging
  • Introduce abstracted app shell (showErrorMessage etc and file system for testability

await this.executeAndOutput('brew', ['install', 'python']);
}
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

What if platform is Linux?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I think it should be like Windows then

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I think linux too has a version of Python pre-installed. Brett Cannon (@brettcannon) Do you think we should support the system python in linux?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Or we can leave Linux alone and let users figure it out?

return this._isMac;
}
public get isLinux(): boolean {
return !(this.isWindows || this.isLinux);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Isn't the condition supposed to be return !(this.isWindows || this.isMac);

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Good catch...

Comment thread src/test/index.ts Outdated
timeout: 25000,
retries: 3
retries: 3,
grep: 'Signatures'

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Booboo

MikhailArkhipov added 2 commits January 2, 2018 15:17
Comment thread src/client/extension.ts Outdated

const pythonInstaller = new PythonInstaller(serviceContainer);
const passed = await pythonInstaller.checkPythonInstallation();
const passed = await pythonInstaller.checkPythonInstallation(PythonSettings.getInstance());

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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)

Comment thread src/test/index.ts Outdated
timeout: 25000,
retries: 3,
grep: 'Signatures'
grep: 'Installation'

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Please remove this.

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');

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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()) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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 ? '\\' : '/';

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

please use path.sep instead

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

OK

}

public existsAsync(filePath: string): Promise<boolean> {
return new Promise<boolean>(resolve => {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Sure, I can add dir/file separately. We can add more as we go. I didn't want to add all possible combos.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Yes sure.

}

public createDirectoryAsync(directoryPath: string): Promise<boolean> {
return new Promise<boolean>(resolve => {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

you can use fs.mkdirp. I wouldn't swallow the exceptions, just use return fs.mkdirp(directoryPath)

await this.executeAndOutput('brew', ['install', 'python']);
}
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I think linux too has a version of Python pre-installed. Brett Cannon (@brettcannon) Do you think we should support the system python in linux?

Comment thread src/client/extension.ts Outdated
const interpreterManager = new InterpreterManager(serviceContainer);

const pythonInstaller = new PythonInstaller(serviceContainer);
const passed = await pythonInstaller.checkPythonInstallation(PythonSettings.getInstance());

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I'd say this is where Dan Taylor (@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.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Add Don't show this again?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I'd wait for Dan Taylor (@qubitron) to comment on this.

Comment thread src/test/index.ts Outdated
timeout: 25000,
retries: 3
retries: 3,
grep: 'Installation'

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Please remove

Mikhail Arkhipov (MikhailArkhipov) merged commit 4372809 into microsoft:master Jan 4, 2018
Don Jayamanne (DonJayamanne) added a commit that referenced this pull request Jan 9, 2018
* upstream/master:
  Improve interpreter selection on different platforms (#517)
  Yarn and code coverage (#475)
lock Bot locked as resolved and limited conversation to collaborators Jul 31, 2019
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL