Add functionality to use an existing Python installation for Notebook dependencies (#5228)

This commit is contained in:
Cory Rivera
2019-05-17 14:39:44 -07:00
committed by GitHub
parent 1fce604a11
commit a59d1d3c05
8 changed files with 248 additions and 69 deletions

View File

@@ -21,6 +21,7 @@ export const pyspark3kernel = 'pyspark3kernel';
export const python3DisplayName = 'Python 3';
export const defaultSparkKernel = 'pyspark3kernel';
export const pythonPathConfigKey = 'pythonPath';
export const existingPythonConfigKey = 'useExistingPython';
export const notebookConfigKey = 'notebook';
export const outputChannelName = 'dataManagement';
@@ -49,3 +50,8 @@ export enum BuiltInCommands {
export enum CommandContext {
WizardServiceEnabled = 'wizardservice:enabled'
}
export const pythonOfflinePipPackagesUrl = 'https://go.microsoft.com/fwlink/?linkid=2092867';
export const pythonWindowsInstallUrl = 'https://go.microsoft.com/fwlink/?linkid=2092866';
export const pythonMacInstallUrl = 'https://go.microsoft.com/fwlink/?linkid=2092865';
export const pythonLinuxInstallUrl = 'https://go.microsoft.com/fwlink/?linkid=2092864';

View File

@@ -14,6 +14,6 @@ export const msgNo = localize('msgNo', 'No');
// Jupyter Constants ///////////////////////////////////////////////////////
export const msgManagePackagesPowershell = localize('msgManagePackagesPowershell', '<#\n--------------------------------------------------------------------------------\n\tThis is the sandboxed instance of python used by Jupyter server.\n\tTo install packages used by the python kernel use \'.\\python.exe -m pip install\'\n--------------------------------------------------------------------------------\n#>');
export const msgManagePackagesBash = localize('msgJupyterManagePackagesBash', ': \'\n--------------------------------------------------------------------------------\n\tThis is the sandboxed instance of python used by Jupyter server.\n\tTo install packages used by the python kernel use \'./python3.6 -m pip install\'\n--------------------------------------------------------------------------------\n\'');
export const msgManagePackagesBash = localize('msgJupyterManagePackagesBash', ': \'\n--------------------------------------------------------------------------------\n\tThis is the sandboxed instance of python used by Jupyter server.\n\tTo install packages used by the python kernel use \'./python3 -m pip install\'\n--------------------------------------------------------------------------------\n\'');
export const msgManagePackagesCmd = localize('msgJupyterManagePackagesCmd', 'REM This is the sandboxed instance of python used by Jupyter server. To install packages used by the python kernel use \'.\\python.exe -m pip install\'');
export const msgSampleCodeDataFrame = localize('msgSampleCodeDataFrame', 'This sample code loads the file into a data frame and shows the first 10 results.');

View File

@@ -54,13 +54,15 @@ export function executeBufferedCommand(cmd: string, options: childProcess.ExecOp
});
}
export function executeStreamedCommand(cmd: string, outputChannel?: vscode.OutputChannel): Thenable<void> {
export function executeStreamedCommand(cmd: string, options: childProcess.SpawnOptions, outputChannel?: vscode.OutputChannel): Thenable<void> {
return new Promise<void>((resolve, reject) => {
// Start the command
if (outputChannel) {
outputChannel.appendLine(` > ${cmd}`);
}
let child = childProcess.spawn(cmd, [], { shell: true, detached: false });
options.shell = true;
options.detached = false;
let child = childProcess.spawn(cmd, [], options);
// Add listeners to resolve/reject the promise on exit
child.on('error', reject);