Skip to content
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

Merged
merged 151 commits into from
Dec 11, 2017

Conversation

DonJayamanne
Copy link

@DonJayamanne DonJayamanne commented Dec 9, 2017

octref and others added 30 commits November 3, 2017 13:11
* '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)
const executionInfo = await this.getExecutionInfo(name, resource);
const terminalService = this.serviceContainer.get<ITerminalService>(ITerminalService);

if (executionInfo.moduleName) {
Copy link
Member

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?

Copy link
Author

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.

x86 = 2,
x64 = 3
}
export enum Hive {
Copy link
Member

Choose a reason for hiding this comment

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

What is Hive?

Copy link
Author

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
Copy link
Member

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;
Copy link
Member

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) {
Copy link
Member

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.

Copy link
Author

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';
Copy link
Member

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?

Copy link
Author

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';
Copy link
Member

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.

Copy link
Author

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.

@DonJayamanne
Copy link
Author

@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
Copy link
Member

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.

@DonJayamanne DonJayamanne merged commit b0fb5c0 into microsoft:master Dec 11, 2017
@DonJayamanne DonJayamanne deleted the CondaModuleInstaller branch December 12, 2017 21:21
@lock lock bot locked as resolved and limited conversation to collaborators Jul 31, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
3 participants