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

Voilite POC #1187

Merged
merged 10 commits into from
Feb 20, 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
5 changes: 4 additions & 1 deletion .binder/postBuild
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,7 @@ jlpm && jlpm run build
python -m pip install -e .
jupyter labextension develop . --overwrite
jupyter server extension enable voila.server_extension --sys-prefix
jupyter serverextension enable voila.server_extension --sys-prefix
jupyter serverextension enable voila.server_extension --sys-prefix

# force installing ipywidgets 8
python -m pip install --pre -U ipywidgets
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ share/jupyter/voila/templates/reveal/static/materialcolors.css
lib

voila/labextension
voila/voilite/static/**/*

tsconfig.tsbuildinfo

ui-tests/playwright-report
Expand Down
6 changes: 2 additions & 4 deletions packages/voila/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,5 @@
export * from './app';
export * from './manager';
export * from './shell';

import * as plugins from './plugins';

export { plugins };
export * from './output';
export * from './plugins';
4 changes: 2 additions & 2 deletions packages/voila/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { PageConfig, URLExt } from '@jupyterlab/coreutils';

import { VoilaApp } from './app';
import { VoilaShell } from './shell';
import plugins from './plugins';

function loadScript(url: string): Promise<any> {
return new Promise((resolve, reject) => {
Expand Down Expand Up @@ -68,9 +69,8 @@ async function main() {
// This would also need the theme manager plugin and settings
// require('@jupyterlab/theme-light-extension'),
// require('@jupyterlab/theme-dark-extension'),
require('./plugins')
plugins
];

const mimeExtensions = [require('@jupyterlab/json-extension')];

/**
Expand Down
14 changes: 7 additions & 7 deletions packages/voila/src/plugins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import { WidgetManager as VoilaWidgetManager } from './manager';
/**
* The default paths.
*/
const paths: JupyterFrontEndPlugin<JupyterFrontEnd.IPaths> = {
export const pathsPlugin: JupyterFrontEndPlugin<JupyterFrontEnd.IPaths> = {
id: '@voila-dashboards/voila:paths',
activate: (
app: JupyterFrontEnd<JupyterFrontEnd.IShell>
Expand All @@ -51,7 +51,7 @@ const paths: JupyterFrontEndPlugin<JupyterFrontEnd.IPaths> = {
* TODO: a cleaner solution would involve a custom ServiceManager to the VoilaApp
* to prevent the default behavior of polling the /api endpoints.
*/
const stopPolling: JupyterFrontEndPlugin<void> = {
export const stopPollingPlugin: JupyterFrontEndPlugin<void> = {
id: '@voila-dashboards/voila:stop-polling',
autoStart: true,
activate: (app: JupyterFrontEnd): void => {
Expand All @@ -69,7 +69,7 @@ const stopPolling: JupyterFrontEndPlugin<void> = {
/**
* A simplified Translator
*/
const translator: JupyterFrontEndPlugin<ITranslator> = {
export const translatorPlugin: JupyterFrontEndPlugin<ITranslator> = {
id: '@voila-dashboards/voila:translator',
activate: (app: JupyterFrontEnd<JupyterFrontEnd.IShell>): ITranslator => {
const translationManager = new TranslationManager();
Expand All @@ -82,7 +82,7 @@ const translator: JupyterFrontEndPlugin<ITranslator> = {
/**
* The Voila widgets manager plugin.
*/
const widgetManager: JupyterFrontEndPlugin<IJupyterWidgetRegistry> = {
export const widgetManager: JupyterFrontEndPlugin<IJupyterWidgetRegistry> = {
id: '@voila-dashboards/voila:widget-manager',
autoStart: true,
requires: [IRenderMimeRegistry],
Expand Down Expand Up @@ -135,9 +135,9 @@ const widgetManager: JupyterFrontEndPlugin<IJupyterWidgetRegistry> = {
* Export the plugins as default.
*/
const plugins: JupyterFrontEndPlugin<any>[] = [
paths,
stopPolling,
translator,
pathsPlugin,
stopPollingPlugin,
translatorPlugin,
widgetManager
];

Expand Down
93 changes: 93 additions & 0 deletions packages/voilite/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
{
"name": "@voila-dashboards/voilite",
"version": "0.5.0-alpha.0",
"description": "The Voilite Frontend",
"author": "Voilà contributors",
"license": "BSD-3-Clause",
"main": "lib/index.js",
"browserslist": ">0.8%, not ie 11, not op_mini all, not dead",
"dependencies": {
"@jupyter-widgets/base": "^6.0.1",
"@jupyter-widgets/controls": "^5.0.1",
"@jupyter-widgets/jupyterlab-manager": "^5.0.3",
"@jupyter-widgets/output": "^6.0.1",
"@jupyterlab/application": "^3.0.0",
"@jupyterlab/apputils": "^3.0.0",
"@jupyterlab/apputils-extension": "^3.4.8",
"@jupyterlab/coreutils": "^5.0.0",
"@jupyterlab/docregistry": "^3.0.0",
"@jupyterlab/json-extension": "^3.0.0",
"@jupyterlab/logconsole": "^3.0.0",
"@jupyterlab/mainmenu": "^3.0.0",
"@jupyterlab/markdownviewer-extension": "^3.0.0",
"@jupyterlab/mathjax2-extension": "^3.0.0",
"@jupyterlab/nbconvert-css": "^3.4.8",
"@jupyterlab/nbformat": "^3.0.0",
"@jupyterlab/notebook": "^3.0.0",
"@jupyterlab/outputarea": "^3.0.0",
"@jupyterlab/rendermime": "^3.0.0",
"@jupyterlab/rendermime-extension": "^3.0.0",
"@jupyterlab/services": "^6.1.8",
"@jupyterlab/settingregistry": "^3.0.0",
"@jupyterlab/theme-dark-extension": "^3.4.8",
"@jupyterlab/theme-light-extension": "^3.4.8",
"@jupyterlab/translation": "^3.0.0",
"@jupyterlab/ui-components": "^3.0.0",
"@jupyterlite/iframe-extension": "^0.1.0-beta.13",
"@jupyterlite/pyolite-kernel-extension": "^0.1.0-beta.13",
"@jupyterlite/server": "^0.1.0-beta.13",
"@jupyterlite/server-extension": "^0.1.0-beta.13",
"@lumino/algorithm": "^1.6.2",
"@lumino/commands": "^1.15.2",
"@lumino/coreutils": "^1.8.2",
"@lumino/disposable": "^1.7.2",
"@lumino/domutils": "^1.5.2",
"@lumino/dragdrop": "^1.10.2",
"@lumino/messaging": "^1.7.2",
"@lumino/properties": "^1.5.2",
"@lumino/signaling": "^1.7.2",
"@lumino/virtualdom": "^1.11.2",
"@lumino/widgets": "^1.26.2",
"@voila-dashboards/voila":"^0.5.0-alpha.0",
"react": "^17.0.1"
},
"devDependencies": {
"@babel/core": "^7.2.2",
"@babel/preset-env": "^7.3.1",
"@jupyterlab/builder": "^3.0.0",
"@types/node": "^18.8.3",
"babel-loader": "^8.0.5",
"css-loader": "~5.0.2",
"file-loader": "^6.2.0",
"fs-extra": "^9.1.0",
"glob": "~7.1.6",
"ignore-loader": "^0.1.2",
"json-loader": "^0.5.7",
"mini-css-extract-plugin": "~0.9.0",
"npm-run-all": "^4.1.5",
"p-limit": "^2.2.2",
"raw-loader": "^4.0.2",
"rimraf": "^3.0.2",
"style-loader": "^2.0.0",
"svg-url-loader": "^7.1.1",
"typescript": "~4.1.3",
"url-loader": "^4.1.1",
"watch": "^1.0.2",
"webpack": "^5.24.1",
"webpack-bundle-analyzer": "^4.4.0",
"webpack-cli": "^4.5.0",
"webpack-merge": "^5.7.3",
"whatwg-fetch": "^3.0.0"
},
"scripts": {
"build": "npm run build:lib && webpack --mode=development",
"build:lib": "tsc",
"build:prod": "npm run build:lib && webpack --mode=production",
"clean": "jlpm run clean:lib && rimraf build",
"clean:lib": "rimraf lib tsconfig.tsbuildinfo",
"test": "echo \"Error: no test specified\" && exit 1",
"watch": "npm-run-all -p watch:*",
"watch:lib": "tsc -w",
"watch:bundle": "webpack --watch --mode=development"
}
}
37 changes: 37 additions & 0 deletions packages/voilite/publicpath.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.

// We dynamically set the webpack public path based on the page config
// settings from the JupyterLab app. We copy some of the pageconfig parsing
// logic in @jupyterlab/coreutils below, since this must run before any other
// files are loaded (including @jupyterlab/coreutils).

/**
* Get global configuration data for the Jupyter application.
*
* @param name - The name of the configuration option.
*
* @returns The config value or an empty string if not found.
*
* #### Notes
* All values are treated as strings.
* For browser based applications, it is assumed that the page HTML
* includes a script tag with the id `jupyter-config-data` containing the
* configuration as valid JSON. In order to support the classic Notebook,
* we fall back on checking for `body` data of the given `name`.
*/
function getOption(name) {
let configData = Object.create(null);
// Use script tag if available.
if (typeof document !== 'undefined' && document) {
const el = document.getElementById('jupyter-config-data');

if (el) {
configData = JSON.parse(el.textContent || '{}');
}
}
return configData[name] || '';
}

// eslint-disable-next-line no-undef
__webpack_public_path__ = getOption('fullStaticUrl') + '/';
Loading