From 5a4d1599db9618dbca21d6fe2ba4b2a6b8ef6dd0 Mon Sep 17 00:00:00 2001 From: Cory Rivera Date: Wed, 6 Oct 2021 08:52:54 -0700 Subject: [PATCH] Improve Configure Python wizard experience for unfamiliar kernel names. (#17272) --- extensions/notebook/src/common/constants.ts | 1 + .../src/dialog/configurePython/configurePathPage.ts | 2 +- .../src/dialog/configurePython/configurePythonWizard.ts | 7 +++++++ .../src/dialog/configurePython/pickPackagesPage.ts | 4 ++-- .../notebook/src/jupyter/jupyterServerInstallation.ts | 1 + 5 files changed, 12 insertions(+), 3 deletions(-) diff --git a/extensions/notebook/src/common/constants.ts b/extensions/notebook/src/common/constants.ts index aed41b9154..1d7f1bd518 100644 --- a/extensions/notebook/src/common/constants.ts +++ b/extensions/notebook/src/common/constants.ts @@ -42,6 +42,7 @@ export const localhostName = 'localhost'; export const localhostTitle = localize('managePackages.localhost', "localhost"); export const PackageNotFoundError = localize('managePackages.packageNotFound', "Could not find the specified package"); +export const ipykernelDisplayName = 'Python 3 (ipykernel)'; export const python3DisplayName = 'Python 3'; export const pysparkDisplayName = 'PySpark'; export const sparkScalaDisplayName = 'Spark | Scala'; diff --git a/extensions/notebook/src/dialog/configurePython/configurePathPage.ts b/extensions/notebook/src/dialog/configurePython/configurePathPage.ts index 8454279709..ee2d052f1b 100644 --- a/extensions/notebook/src/dialog/configurePython/configurePathPage.ts +++ b/extensions/notebook/src/dialog/configurePython/configurePathPage.ts @@ -27,7 +27,7 @@ export class ConfigurePathPage extends BasePage { public async initialize(): Promise { let wizardDescription: string; if (this.model.kernelName) { - wizardDescription = localize('configurePython.descriptionWithKernel', "The {0} kernel requires a Python runtime to be configured and dependencies to be installed.", this.model.kernelName); + wizardDescription = localize('configurePython.descriptionWithKernel', "The '{0}' kernel requires a Python runtime to be configured and dependencies to be installed.", this.model.kernelName); } else { wizardDescription = localize('configurePython.descriptionWithoutKernel', "Notebook kernels require a Python runtime to be configured and dependencies to be installed."); } diff --git a/extensions/notebook/src/dialog/configurePython/configurePythonWizard.ts b/extensions/notebook/src/dialog/configurePython/configurePythonWizard.ts index 38b04571d7..7df8efb7af 100644 --- a/extensions/notebook/src/dialog/configurePython/configurePythonWizard.ts +++ b/extensions/notebook/src/dialog/configurePython/configurePythonWizard.ts @@ -128,6 +128,13 @@ export class ConfigurePythonWizard { await this._wizard.close(); } + public showInfoMessage(errorMsg: string) { + this._wizard.message = { + text: errorMsg, + level: azdata.window.MessageLevel.Information + }; + } + public showErrorMessage(errorMsg: string) { this._wizard.message = { text: errorMsg, diff --git a/extensions/notebook/src/dialog/configurePython/pickPackagesPage.ts b/extensions/notebook/src/dialog/configurePython/pickPackagesPage.ts index cfe178266b..d978173cb0 100644 --- a/extensions/notebook/src/dialog/configurePython/pickPackagesPage.ts +++ b/extensions/notebook/src/dialog/configurePython/pickPackagesPage.ts @@ -158,9 +158,9 @@ export class PickPackagesPage extends BasePage { this.requiredPackagesTable.data = requiredPkgVersions.map(pkg => [pkg.name, pkg.existingVersion ?? '-', pkg.requiredVersion]); this.model.packagesToInstall = requiredPackages; } else { - this.instance.showErrorMessage(localize('msgUnsupportedKernel', "Could not retrieve packages for kernel {0}", kernelName)); + this.instance.showInfoMessage(localize('msgNoRequirementsForKernel', "No packages are required by default for the kernel '{0}'", kernelName)); this.requiredPackagesTable.data = [['-', '-', '-']]; - this.model.packagesToInstall = undefined; + this.model.packagesToInstall = []; } } finally { this.instance.wizard.doneButton.enabled = true; diff --git a/extensions/notebook/src/jupyter/jupyterServerInstallation.ts b/extensions/notebook/src/jupyter/jupyterServerInstallation.ts index 3e6b19a6a6..5e24963857 100644 --- a/extensions/notebook/src/jupyter/jupyterServerInstallation.ts +++ b/extensions/notebook/src/jupyter/jupyterServerInstallation.ts @@ -154,6 +154,7 @@ export class JupyterServerInstallation implements IJupyterServerInstallation { this._kernelSetupCache = new Map(); this._requiredKernelPackages = new Map(); + this._requiredKernelPackages.set(constants.ipykernelDisplayName, [requiredJupyterPkg]); this._requiredKernelPackages.set(constants.python3DisplayName, [requiredJupyterPkg]); this._requiredKernelPackages.set(constants.powershellDisplayName, [requiredJupyterPkg, requiredPowershellPkg]); this._requiredKernelPackages.set(constants.pysparkDisplayName, requiredSparkPackages);