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

changes from ocean in 4.1.8 #30

Open
wants to merge 6 commits into
base: 4.3.x-ocean
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions dev_mode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
"@jupyterlab/lsp": "~4.3.3",
"@jupyterlab/lsp-extension": "~4.3.3",
"@jupyterlab/mainmenu": "~4.3.3",
"@jupyterlab/mainmenu-extension": "~4.3.3",
"@jupyterlab/mainmenu-extension": "../packages/mainmenu-extension",
"@jupyterlab/markdownviewer": "~4.3.3",
"@jupyterlab/markdownviewer-extension": "~4.3.3",
"@jupyterlab/markedparser-extension": "~4.3.3",
Expand All @@ -97,7 +97,7 @@
"@jupyterlab/rendermime-interfaces": "~3.11.3",
"@jupyterlab/running": "~4.3.3",
"@jupyterlab/running-extension": "~4.3.3",
"@jupyterlab/services": "~7.3.3",
"@jupyterlab/services": "../packages/services",
"@jupyterlab/settingeditor": "~4.3.3",
"@jupyterlab/settingeditor-extension": "~4.3.3",
"@jupyterlab/settingregistry": "~4.3.3",
Expand All @@ -116,7 +116,7 @@
"@jupyterlab/tooltip-extension": "~4.3.3",
"@jupyterlab/translation": "~4.3.3",
"@jupyterlab/translation-extension": "~4.3.3",
"@jupyterlab/ui-components": "~4.3.3",
"@jupyterlab/ui-components": "../packages/ui-components",
"@jupyterlab/ui-components-extension": "~4.3.3",
"@jupyterlab/vega5-extension": "~4.3.3",
"@jupyterlab/workspaces": "~4.3.3",
Expand Down
7 changes: 7 additions & 0 deletions jupyterlab/semver.py
Original file line number Diff line number Diff line change
Expand Up @@ -747,6 +747,13 @@ def make_range(range_, loose):

class Range:
def __init__(self, range_, loose):
if "/services" in range_:
range_ = "~7.3.2"
elif "/ui-components" in range_:
range_ = "~4.3.2"
elif "/mainmenu-extension" in range_:
range_ = "~4.3.2"

self.loose = loose
# First, split based on boolean or ||
self.raw = range_
Expand Down
6 changes: 3 additions & 3 deletions jupyterlab/staging/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
"@jupyterlab/lsp": "~4.3.3",
"@jupyterlab/lsp-extension": "~4.3.3",
"@jupyterlab/mainmenu": "~4.3.3",
"@jupyterlab/mainmenu-extension": "~4.3.3",
"@jupyterlab/mainmenu-extension": "../../packages/mainmenu-extension",
"@jupyterlab/markdownviewer": "~4.3.3",
"@jupyterlab/markdownviewer-extension": "~4.3.3",
"@jupyterlab/markedparser-extension": "~4.3.3",
Expand All @@ -97,7 +97,7 @@
"@jupyterlab/rendermime-interfaces": "~3.11.3",
"@jupyterlab/running": "~4.3.3",
"@jupyterlab/running-extension": "~4.3.3",
"@jupyterlab/services": "~7.3.3",
"@jupyterlab/services": "../../packages/services",
"@jupyterlab/settingeditor": "~4.3.3",
"@jupyterlab/settingeditor-extension": "~4.3.3",
"@jupyterlab/settingregistry": "~4.3.3",
Expand All @@ -116,7 +116,7 @@
"@jupyterlab/tooltip-extension": "~4.3.3",
"@jupyterlab/translation": "~4.3.3",
"@jupyterlab/translation-extension": "~4.3.3",
"@jupyterlab/ui-components": "~4.3.3",
"@jupyterlab/ui-components": "../../packages/ui-components",
"@jupyterlab/ui-components-extension": "~4.3.3",
"@jupyterlab/vega5-extension": "~4.3.3",
"@jupyterlab/workspaces": "~4.3.3",
Expand Down
8 changes: 4 additions & 4 deletions packages/mainmenu-extension/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -370,8 +370,8 @@ function createFileMenu(
commands.addCommand(CommandIDs.shutdown, {
label: trans.__('Shut Down'),
caption: trans.__('Shut down %1', app.name),
isVisible: () => menu.quitEntry,
isEnabled: () => menu.quitEntry,
isVisible: () => false,
isEnabled: () => false,
execute: () => {
return showDialog({
title: trans.__('Shutdown confirmation'),
Expand Down Expand Up @@ -439,8 +439,8 @@ function createFileMenu(
commands.addCommand(CommandIDs.logout, {
label: trans.__('Log Out'),
caption: trans.__('Log out of %1', app.name),
isVisible: () => menu.quitEntry,
isEnabled: () => menu.quitEntry,
isVisible: () => false,
isEnabled: () => false,
execute: () => {
router.navigate('/logout', { hard: true });
}
Expand Down
2 changes: 1 addition & 1 deletion packages/services/src/kernel/default.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1235,7 +1235,7 @@ export class KernelConnection implements Kernel.IKernelConnection {
/**
* Create the kernel websocket connection and add socket status handlers.
*/
private _createSocket = (useProtocols = true) => {
private _createSocket = (useProtocols = false) => {
this._errorIfDisposed();

// Make sure the socket is clear
Expand Down
17 changes: 12 additions & 5 deletions packages/services/src/session/default.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ export class SessionConnection implements Session.ISessionConnection {
* Dispose of the resources held by the session.
*/
dispose(): void {
if (this.isDisposed) {
if (this._updating || this.isDisposed) {
return;
}
this._isDisposed = true;
Expand Down Expand Up @@ -391,10 +391,16 @@ export class SessionConnection implements Session.ISessionConnection {
private async _patch(
body: DeepPartial<Session.IModel>
): Promise<Session.IModel> {
const model = await updateSession(
{ ...body, id: this._id },
this.serverSettings
);
this._updating = true;
let model: Session.IModel;
try {
model = await updateSession(
{...body, id: this._id},
this.serverSettings
);
} finally {
this._updating = false;
}
this.update(model);
return model;
}
Expand Down Expand Up @@ -422,6 +428,7 @@ export class SessionConnection implements Session.ISessionConnection {
private _clientId: string;
private _kernel: Kernel.IKernelConnection | null = null;
private _isDisposed = false;
private _updating = false;
private _disposed = new Signal<this, void>(this);
private _kernelChanged = new Signal<
this,
Expand Down
88 changes: 75 additions & 13 deletions packages/services/src/session/restapi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ export async function getSessionModel(
return data;
}

function sleep(ms: number | undefined) {
return new Promise(resolve => setTimeout(resolve, ms));
}

/**
* Create a new session, or return an existing session if the session path
* already exists.
Expand All @@ -105,16 +109,45 @@ export async function startSession(
settings: ServerConnection.ISettings = ServerConnection.makeSettings()
): Promise<Session.IModel> {
const url = URLExt.join(settings.baseUrl, SESSION_SERVICE_URL);
const init = {
const body = JSON.stringify(options);
const bodyjson = JSON.parse(body);
bodyjson['id'] = '';
let init = {
method: 'POST',
body: JSON.stringify(options)
body: JSON.stringify(bodyjson)
};
const response = await ServerConnection.makeRequest(url, init, settings);
if (response.status !== 201) {
const err = await ServerConnection.ResponseError.create(response);
throw err;
let data = { id: '', execution_state: 'waiting' };
let count = 0;
while (count++ < 300) {
const response = await ServerConnection.makeRequest(url, init, settings);
if (response.status !== 201) {
throw await ServerConnection.ResponseError.create(response);
}
data = await response.json();
if (data.execution_state != 'waiting') {
console.log(
'Kernel started in session ' + data.id + ' after ' + count + ' seconds'
);
break;
} else {
bodyjson['id'] = data.id;
init = {
method: 'POST',
body: JSON.stringify(bodyjson)
};
await sleep(2000);
console.log(
'Waiting for kernel in session ' +
data.id +
' for ' +
2 * count +
' seconds'
);
}
}
if (count >= 300) {
throw new Error('10 minute timeout waiting for kernel to start');
}
const data = await response.json();
updateLegacySessionModel(data);
validateModel(data);
return data;
Expand All @@ -128,16 +161,45 @@ export async function updateSession(
settings: ServerConnection.ISettings = ServerConnection.makeSettings()
): Promise<Session.IModel> {
const url = getSessionUrl(settings.baseUrl, model.id);
const init = {
const body = JSON.stringify(model);
const bodyjson = JSON.parse(body);
bodyjson['id'] = '';
let init = {
method: 'PATCH',
body: JSON.stringify(model)
};
const response = await ServerConnection.makeRequest(url, init, settings);
if (response.status !== 200) {
const err = await ServerConnection.ResponseError.create(response);
throw err;
let data = { id: '', execution_state: 'waiting' };
let count = 0;
while (count++ < 300) {
const response = await ServerConnection.makeRequest(url, init, settings);
if (response.status !== 200 && response.status !== 201) {
throw await ServerConnection.ResponseError.create(response);
}
data = await response.json();
if (data.execution_state != 'waiting') {
console.log(
'Kernel started in update session ' + data.id + ' after ' + count + ' seconds'
);
break;
} else {
bodyjson['id'] = data.id;
init = {
method: 'PATCH',
body: JSON.stringify(bodyjson)
};
await sleep(2000);
console.log(
'Waiting for kernel in update session ' +
data.id +
' for ' +
2 * count +
' seconds'
);
}
}
if (count >= 300) {
throw new Error('10 minute timeout waiting for kernel to start');
}
const data = await response.json();
updateLegacySessionModel(data);
validateModel(data);
return data;
Expand Down
6 changes: 3 additions & 3 deletions packages/ui-components/style/icons/jupyter/jupyter.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 5 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ name = "jupyterlab"
description = "JupyterLab computational environment"
readme = "README.md"
license = { file = "LICENSE" }
requires-python = ">=3.8"
requires-python = ">=3.11"
authors = [
{ name = "Jupyter Development Team", email = "jupyter@googlegroups.com" },
]
Expand Down Expand Up @@ -42,7 +42,7 @@ dependencies = [
"ipykernel>=6.5.0",
"jinja2>=3.0.3",
"jupyter_core",
"jupyter_server>=2.4.0,<3",
"jupyter_server@git+https://github.com/spotinst/jupyter_server.git@ddf0b98",
"jupyter-lsp>=2.0.0",
"jupyterlab_server>=2.27.1,<3",
"notebook_shim>=0.2",
Expand All @@ -56,6 +56,9 @@ dynamic = [
"version",
]

[tool.hatch.metadata]
allow-direct-references = true

[project.scripts]
jlpm = "jupyterlab.jlpmapp:main"
jupyter-lab = "jupyterlab.labapp:main"
Expand Down
Loading