-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ability to install modules using pip or conda #380
Ability to install modules using pip or conda #380
Conversation
DonJayamanne
commented
Dec 9, 2017
•
edited
Loading
edited
- Add support for pip and/or conda when installing modules
- Fix display versions for environments (fixes Incorrect display name for conda environment #378)
- Refactor installer to use the pip/conda module installer for installation of modules
- Performance improvement of detecting virtual env and setting it (fixes Improve performance of automatic environment detection #372)
- Code refactor to ensure interpreter locators use the new DI framework
- Fixes Installing pylint fails if pip module is not installed #266
Archive of 0.7.0
* 'master' of https://github.com/Microsoft/vscode-python: Fixes #56 list all environments (#219) Fixes #57 Disable activation on debugging (#220) Fixes #26 Do not run linters when linters are disabled (#222)
* upstream/master: Fix typo in README.md (#252) Disable linter without workspaces (#241)
* upstream/master: Ensure python path is not set if already set in user settings (#369) Use 'an' rather than 'a' before vowel words (#373)
* upstream/master: Use new environment variable parser (#362)
const executionInfo = await this.getExecutionInfo(name, resource); | ||
const terminalService = this.serviceContainer.get<ITerminalService>(ITerminalService); | ||
|
||
if (executionInfo.moduleName) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does having a module name decide to use pip versus something else? And won't the concrete implementations like PipInstaller
handle the actual installation versus this default use of pip
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If its a module, then we have a separate set of installers. I wanted to add that separation early on so we could create separate installers for python modules vs stand alone tools such as ctags or the like.
src/client/common/platform/types.ts
Outdated
x86 = 2, | ||
x64 = 3 | ||
} | ||
export enum Hive { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is Hive
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will rename to RegistryHive
this.terminal.show(false); | ||
|
||
// Sometimes the terminal takes some time to start up before it can start accepting input. | ||
// However if we have already sent text to the terminal, then no need to wait |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing a period.
import { IServiceContainer } from '../../ioc/types'; | ||
import { IErrorHandler, ILinterHelper } from '../types'; | ||
import { BaseErrorHandler } from './baseErrorHandler'; | ||
import { ModuleNotInstalledErrorHandler } from './notInstalled'; | ||
import { StandardErrorHandler } from './standard'; | ||
|
||
export class ErrorHandler implements IErrorHandler { | ||
private handler: BaseErrorHandler; | ||
private handlder: BaseErrorHandler; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You made your favourite spelling mistake again. 😉
@@ -20,7 +19,7 @@ export class ModuleNotInstalledErrorHandler extends BaseErrorHandler { | |||
|
|||
const pythonExecutionService = await this.serviceContainer.get<IPythonExecutionFactory>(IPythonExecutionFactory).create(resource); | |||
const isModuleInstalled = await pythonExecutionService.isModuleInstalled(execInfo.moduleName!); | |||
if (!isModuleInstalled) { | |||
if (isModuleInstalled) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just want to double-check this was a bug previously that's being fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but not reported. I identified it while testing this PR.
@@ -3,8 +3,7 @@ | |||
|
|||
import { Uri } from 'vscode'; | |||
import { ILintingSettings } from '../common/configSettings'; | |||
import { Product } from '../common/installer'; | |||
import { ExecutionInfo } from '../common/types'; | |||
import { ExecutionInfo, Product } from '../common/types'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are all of these modules importing Product
but not using it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are being used. The change made here is to move Product
enum from installer
into common
area.
@@ -47,17 +48,39 @@ export class TestsHelper implements ITestsHelper { | |||
constructor( @inject(ITestVisitor) @named('TestFlatteningVisitor') private flatteningVisitor: TestFlatteningVisitor) { } | |||
public parseProviderName(product: UnitTestProduct): TestProvider { | |||
switch (product) { | |||
case Product.nosetest: { | |||
return 'nosetest'; | |||
case Product.nosetest: return 'nosetest'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't we already have this mapping somewhere else? I know this is like the second mapping we have for names.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that's in the installers. to translate the products to corresponding python modules
. But this is used as a unique identifier within the extension which maps to names used in package.json and other settings.
For instance, the id of nose tests is nosetest
, that's whats used in package.json (settings). When installing this, the product nosetest
is translated to the module name nose
and when running the tests, the module is translated to the module nosetest
.
…e/pythonVSCode into CondaModuleInstaller
@brettcannon ready for review |
gulpfile.js
Outdated
@@ -221,8 +221,8 @@ const hygiene = (options) => { | |||
.pipe(filter(tslintFilter)); | |||
|
|||
if (!options.skipFormatCheck) { | |||
result = result | |||
.pipe(formatting); | |||
// result = result |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left in commented-out code.