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

Update to Voila 0.5.0a3 #44

Merged
merged 4 commits into from
Mar 23, 2023
Merged
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
2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ dependencies:
- yarn=1
- flake8
- pip:
- voila>=0.5.0a2,<0.6.0
- voila>=0.5.0a3,<0.6.0
- voila-material>=0.4.3
- jupyterlite-core[lab]>=0.1.0b20,<0.2.0
- jupyterlite-xeus-python >= 0.7.0
2 changes: 1 addition & 1 deletion packages/voici/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"@lumino/signaling": "^1.7.2",
"@lumino/virtualdom": "^1.11.2",
"@lumino/widgets": "^1.26.2",
"@voila-dashboards/voila": "^0.5.0-alpha.1",
"@voila-dashboards/voila": "^0.5.0-alpha.3",
"react": "^17.0.1"
},
"devDependencies": {
Expand Down
23 changes: 19 additions & 4 deletions packages/voici/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,19 @@ import {
standardRendererFactories,
} from '@jupyterlab/rendermime';
import { IShell, VoilaShell } from '@voila-dashboards/voila';
import { VoiciWidgetManager } from './manager';
import { IKernelConnection } from '@jupyterlab/services/lib/kernel/kernel';
import { IKernelSpecs } from '@jupyterlite/kernel';
import {
KernelWidgetManager,
WidgetRenderer,
} from '@jupyter-widgets/jupyterlab-manager';
import { PromiseDelegate } from '@lumino/coreutils';
import { Widget } from '@lumino/widgets';

const PACKAGE = require('../package.json');

const WIDGET_MIMETYPE = 'application/vnd.jupyter.widget-view+json';

/**
* App is the main application class. It is instantiated once and shared.
*/
Expand Down Expand Up @@ -64,7 +69,7 @@ export class VoiciApp extends JupyterFrontEnd<IShell> {
/**
* A promise that resolves when the Voici Widget Manager is created
*/
get widgetManagerPromise(): PromiseDelegate<VoiciWidgetManager> {
get widgetManagerPromise(): PromiseDelegate<KernelWidgetManager> {
return this._widgetManagerPromise;
}

Expand Down Expand Up @@ -207,7 +212,17 @@ export class VoiciApp extends JupyterFrontEnd<IShell> {
});

// Create Voila widget manager
const widgetManager = new VoiciWidgetManager(kernel, rendermime);
const widgetManager = new KernelWidgetManager(kernel, rendermime);
rendermime.removeMimeType(WIDGET_MIMETYPE);
rendermime.addFactory(
{
safe: false,
mimeTypes: [WIDGET_MIMETYPE],
createRenderer: (options) =>
new WidgetRenderer(options, widgetManager),
},
-10
);
Comment on lines +215 to +225
Copy link
Member

Choose a reason for hiding this comment

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

It's unclear to me why we need to do this? Why is the already registered mimetype renderer for widgets not sufficient?

Copy link
Member

Choose a reason for hiding this comment

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

I also don't remember why we needed a custom widget manager in voici since the beginning.

Copy link
Member Author

Choose a reason for hiding this comment

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

Right I am also unsure. This change mimics what is in voila-dashboards/voila#1249. But maybe there is a way to simplify all this.

Copy link
Member Author

@jtpio jtpio Mar 23, 2023

Choose a reason for hiding this comment

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

It's possible we need it because the stock @jupyter-widgets/jupyterlab-manager extension is not able to render the widgets found on the page if they don't come from a notebook (or document context).

Copy link
Member

Choose a reason for hiding this comment

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

Oh right that rings a bell

this._widgetManagerPromise.resolve(widgetManager);
if (!connection.kernel) {
return;
Expand Down Expand Up @@ -238,7 +253,7 @@ export class VoiciApp extends JupyterFrontEnd<IShell> {

private _serviceManager?: ServiceManager;
private _kernelspecs?: IKernelSpecs;
private _widgetManagerPromise = new PromiseDelegate<VoiciWidgetManager>();
private _widgetManagerPromise = new PromiseDelegate<KernelWidgetManager>();
}

/**
Expand Down
5 changes: 4 additions & 1 deletion packages/voici/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ import { loadComponent, createModule, activePlugins } from './utils';

const serverExtensions = [import('@jupyterlite/server-extension')];

const disabled = ['@jupyter-widgets/jupyterlab-manager'];
const disabled = [
'@jupyter-widgets/jupyterlab-manager:plugin',
'@jupyter-widgets/jupyterlab-manager:saveWidgetState',
];

/**
* The main function
Expand Down
63 changes: 0 additions & 63 deletions packages/voici/src/manager.ts

This file was deleted.

5 changes: 4 additions & 1 deletion packages/voici/src/tree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ import { activePlugins, createModule, loadComponent } from './utils';

const serverExtensions = [import('@jupyterlite/server-extension')];

const disabled = ['@jupyter-widgets/jupyterlab-manager'];
const disabled = [
'@jupyter-widgets/jupyterlab-manager:plugin',
'@jupyter-widgets/jupyterlab-manager:saveWidgetState',
];

/**
* The main function
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ classifiers = [
"Programming Language :: Python :: 3.11",
]
dependencies = [
"voila>=0.5.0a2,<0.6.0",
"voila>=0.5.0a3,<0.6.0",
"jupyterlite-core>=0.1.0b20,<0.2.0",
]
dynamic = [
Expand Down
Loading