Ensure Notebook v6 Pip Package Installed (#24180)

* Force notebook v6

* Ensure installExactVersion

* Fix jupyter installation tests
This commit is contained in:
Chris LaFreniere 2023-08-22 16:04:34 -07:00 коммит произвёл GitHub
Родитель 41ad39f665
Коммит 25a658775c
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 15 добавлений и 9 удалений

Просмотреть файл

@ -83,6 +83,12 @@ export const requiredJupyterPkg: PythonPkgDetails = {
version: '1.0.0'
};
export const requiredNotebookPkg: PythonPkgDetails = {
name: 'notebook',
version: '6.5.5',
installExactVersion: true
};
export const requiredPowershellPkg: PythonPkgDetails = {
name: 'powershell-kernel',
version: '0.1.4'
@ -143,11 +149,11 @@ export class JupyterServerInstallation implements IJupyterServerInstallation {
this._kernelSetupCache = new Map<string, boolean>();
this._requiredKernelPackages = new Map<string, PythonPkgDetails[]>();
this._requiredKernelPackages.set(constants.ipykernelDisplayName, [requiredJupyterPkg]);
this._requiredKernelPackages.set(constants.python3DisplayName, [requiredJupyterPkg]);
this._requiredKernelPackages.set(constants.powershellDisplayName, [requiredJupyterPkg, requiredPowershellPkg]);
this._requiredKernelPackages.set(constants.ipykernelDisplayName, [requiredJupyterPkg, requiredNotebookPkg]);
this._requiredKernelPackages.set(constants.python3DisplayName, [requiredJupyterPkg, requiredNotebookPkg]);
this._requiredKernelPackages.set(constants.powershellDisplayName, [requiredJupyterPkg, requiredPowershellPkg, requiredNotebookPkg]);
let allPackages = [requiredJupyterPkg, requiredPowershellPkg];
let allPackages = [requiredJupyterPkg, requiredNotebookPkg, requiredPowershellPkg];
this._requiredKernelPackages.set(constants.allKernelsName, allPackages);
this._requiredPackagesSet = new Set<string>();
@ -542,7 +548,7 @@ export class JupyterServerInstallation implements IJupyterServerInstallation {
let requiredPackages = this.getRequiredPackagesForKernel(kernelDisplayName);
for (let pkg of requiredPackages) {
let installedVersion = installedPackageMap.get(pkg.name);
if (!installedVersion || utils.compareVersions(installedVersion, pkg.version) < 0) {
if (!installedVersion || utils.compareVersions(installedVersion, pkg.version) < 0 || (pkg.installExactVersion && installedVersion !== pkg.version)) {
return false;
}
}
@ -563,7 +569,7 @@ export class JupyterServerInstallation implements IJupyterServerInstallation {
packages.forEach(pkg => {
let installedPkgVersion = pipVersionMap.get(pkg.name);
if (!installedPkgVersion || utils.compareVersions(installedPkgVersion, pkg.version) < 0) {
if (!installedPkgVersion || utils.compareVersions(installedPkgVersion, pkg.version) < 0 || (pkg.installExactVersion && installedPkgVersion !== pkg.version)) {
packagesToInstall.push(pkg);
}
});

Просмотреть файл

@ -11,7 +11,7 @@ import * as uuid from 'uuid';
import * as fs from 'fs-extra';
import * as request from 'request';
import * as utils from '../../common/utils';
import { requiredJupyterPkg, JupyterServerInstallation, requiredPowershellPkg, PythonInstallSettings, PythonPkgDetails } from '../../jupyter/jupyterServerInstallation';
import { requiredJupyterPkg, JupyterServerInstallation, requiredPowershellPkg, PythonInstallSettings, PythonPkgDetails, requiredNotebookPkg } from '../../jupyter/jupyterServerInstallation';
import { powershellDisplayName, python3DisplayName, winPlatform } from '../../common/constants';
describe('Jupyter Server Installation', function () {
@ -226,12 +226,12 @@ describe('Jupyter Server Installation', function () {
it('Get required packages test - Python 3 kernel', async function () {
let packages = installation.getRequiredPackagesForKernel(python3DisplayName);
should(packages).be.deepEqual([requiredJupyterPkg]);
should(packages).be.deepEqual([requiredJupyterPkg, requiredNotebookPkg]);
});
it('Get required packages test - Powershell kernel', async function () {
let packages = installation.getRequiredPackagesForKernel(powershellDisplayName);
should(packages).be.deepEqual([requiredJupyterPkg, requiredPowershellPkg]);
should(packages).be.deepEqual([requiredJupyterPkg, requiredPowershellPkg, requiredNotebookPkg]);
});
it('Install python test - Run install while Python is already running', async function () {