Skip to content

Commit

Permalink
Try fixing the examples (#13336)
Browse files Browse the repository at this point in the history
* Try fixing the examples

* Fix resolution for federated example

* Correctly handle `terminals_available` setting
  • Loading branch information
fcollonval committed Oct 31, 2022
1 parent f2ab49f commit a059144
Show file tree
Hide file tree
Showing 10 changed files with 33 additions and 57 deletions.
1 change: 0 additions & 1 deletion examples/app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ const extensions = [
import('@jupyterlab/settingeditor-extension'),
import('@jupyterlab/shortcuts-extension'),
import('@jupyterlab/statusbar-extension'),
import('@jupyterlab/terminal-extension'),
import('@jupyterlab/theme-dark-extension'),
import('@jupyterlab/theme-light-extension'),
import('@jupyterlab/toc-extension'),
Expand Down
7 changes: 2 additions & 5 deletions examples/app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@

# Turn off the Jupyter configuration system so configuration files on disk do
# not affect this app. This helps this app to truly be standalone.
# In jupyter-server v2 terminals are an extension. We need the config
# to load the extension
# os.environ["JUPYTER_NO_CONFIG"] = "1"
os.environ["JUPYTER_NO_CONFIG"] = "1"

with open(os.path.join(HERE, "package.json")) as fid:
version = json.load(fid)["version"]
Expand All @@ -27,8 +25,7 @@ class ExampleApp(LabServerApp):
extension_url = "/lab"
default_url = "/lab"
name = __name__
# In jupyter-server v2 terminals are an extension
load_other_extensions = True
load_other_extensions = False
app_name = "JupyterLab Example App"
app_settings_dir = os.path.join(HERE, "build", "application_settings")
app_version = version
Expand Down
2 changes: 0 additions & 2 deletions examples/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
"@jupyterlab/settingeditor-extension": "^4.0.0-alpha.15",
"@jupyterlab/shortcuts-extension": "^4.0.0-alpha.15",
"@jupyterlab/statusbar-extension": "^4.0.0-alpha.15",
"@jupyterlab/terminal-extension": "^4.0.0-alpha.15",
"@jupyterlab/theme-dark-extension": "^4.0.0-alpha.15",
"@jupyterlab/theme-light-extension": "^4.0.0-alpha.15",
"@jupyterlab/toc-extension": "^6.0.0-alpha.15",
Expand Down Expand Up @@ -85,7 +84,6 @@
"@jupyterlab/settingeditor-extension",
"@jupyterlab/shortcuts-extension",
"@jupyterlab/statusbar-extension",
"@jupyterlab/terminal-extension",
"@jupyterlab/theme-dark-extension",
"@jupyterlab/theme-light-extension",
"@jupyterlab/toc-extension",
Expand Down
3 changes: 1 addition & 2 deletions examples/console/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ class ExampleApp(LabServerApp):
extension_url = "/example"
default_url = "/example"
app_url = "/example"
# In jupyter-server v2 terminals are an extension
load_other_extensions = True
load_other_extensions = False
name = __name__
app_name = "JupyterLab Example Console"
app_settings_dir = os.path.join(HERE, "build", "application_settings")
Expand Down
2 changes: 1 addition & 1 deletion examples/example.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { ConsoleMessage, expect, test } from '@playwright/test';

const URL = process.env['BASE_URL'];

test.setTimeout(240000);
test.setTimeout(120000);

test('should load the example', async ({ page }) => {
console.info('Navigating to page:', URL);
Expand Down
55 changes: 25 additions & 30 deletions examples/federated/core_package/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,72 +10,70 @@
"resolutions": {
"@jupyterlab/application": "~4.0.0-alpha.15",
"@jupyterlab/application-extension": "~4.0.0-alpha.15",
"@jupyterlab/apputils": "^4.0.0-alpha.2",
"@jupyterlab/apputils": "^4.0.0-alpha.15",
"@jupyterlab/apputils-extension": "~4.0.0-alpha.15",
"@jupyterlab/attachments": "^4.0.0-alpha.2",
"@jupyterlab/attachments": "^4.0.0-alpha.15",
"@jupyterlab/cells": "~4.0.0-alpha.3",
"@jupyterlab/celltags": "~4.0.0-alpha.3",
"@jupyterlab/celltags-extension": "~4.0.0-alpha.15",
"@jupyterlab/codeeditor": "^4.0.0-alpha.2",
"@jupyterlab/codeeditor": "^4.0.0-alpha.15",
"@jupyterlab/codemirror-extension": "~4.0.0-alpha.15",
"@jupyterlab/collaboration": "^4.0.0-alpha.11",
"@jupyterlab/collaboration-extension": "~4.0.0-alpha.11",
"@jupyterlab/completer": "^4.0.0-alpha.2",
"@jupyterlab/completer": "^4.0.0-alpha.15",
"@jupyterlab/completer-extension": "~4.0.0-alpha.15",
"@jupyterlab/console": "^4.0.0-alpha.2",
"@jupyterlab/console": "^4.0.0-alpha.15",
"@jupyterlab/console-extension": "~4.0.0-alpha.15",
"@jupyterlab/coreutils": "~6.0.0-alpha.15",
"@jupyterlab/csvviewer-extension": "~4.0.0-alpha.15",
"@jupyterlab/debugger": "^4.0.0-alpha.2",
"@jupyterlab/debugger": "^4.0.0-alpha.15",
"@jupyterlab/debugger-extension": "~4.0.0-alpha.15",
"@jupyterlab/docmanager": "^4.0.0-alpha.2",
"@jupyterlab/docmanager": "^4.0.0-alpha.15",
"@jupyterlab/docmanager-extension": "~4.0.0-alpha.15",
"@jupyterlab/documentsearch": "^4.0.0-alpha.2",
"@jupyterlab/documentsearch": "^4.0.0-alpha.15",
"@jupyterlab/documentsearch-extension": "~4.0.0-alpha.15",
"@jupyterlab/extensionmanager": "^4.0.0-alpha.2",
"@jupyterlab/extensionmanager": "^4.0.0-alpha.15",
"@jupyterlab/extensionmanager-extension": "~4.0.0-alpha.15",
"@jupyterlab/filebrowser": "^4.0.0-alpha.2",
"@jupyterlab/filebrowser": "^4.0.0-alpha.15",
"@jupyterlab/filebrowser-extension": "~4.0.0-alpha.15",
"@jupyterlab/fileeditor": "^4.0.0-alpha.2",
"@jupyterlab/fileeditor": "^4.0.0-alpha.15",
"@jupyterlab/fileeditor-extension": "~4.0.0-alpha.15",
"@jupyterlab/help-extension": "~4.0.0-alpha.15",
"@jupyterlab/htmlviewer-extension": "~4.0.0-alpha.15",
"@jupyterlab/hub-extension": "~4.0.0-alpha.15",
"@jupyterlab/imageviewer": "^4.0.0-alpha.2",
"@jupyterlab/imageviewer": "^4.0.0-alpha.15",
"@jupyterlab/imageviewer-extension": "~4.0.0-alpha.15",
"@jupyterlab/inspector": "^4.0.0-alpha.2",
"@jupyterlab/inspector": "^4.0.0-alpha.15",
"@jupyterlab/inspector-extension": "~4.0.0-alpha.15",
"@jupyterlab/javascript-extension": "~4.0.0-alpha.15",
"@jupyterlab/json-extension": "~4.0.0-alpha.15",
"@jupyterlab/launcher": "^4.0.0-alpha.2",
"@jupyterlab/launcher": "^4.0.0-alpha.15",
"@jupyterlab/launcher-extension": "~4.0.0-alpha.15",
"@jupyterlab/logconsole": "^4.0.0-alpha.2",
"@jupyterlab/logconsole": "^4.0.0-alpha.15",
"@jupyterlab/logconsole-extension": "~4.0.0-alpha.15",
"@jupyterlab/lsp": "^4.0.0-alpha.2",
"@jupyterlab/lsp": "^4.0.0-alpha.15",
"@jupyterlab/lsp-extension": "~4.0.0-alpha.15",
"@jupyterlab/mainmenu": "^4.0.0-alpha.2",
"@jupyterlab/mainmenu": "^4.0.0-alpha.15",
"@jupyterlab/mainmenu-extension": "~4.0.0-alpha.15",
"@jupyterlab/markedparser-extension": "~4.0.0-alpha.15",
"@jupyterlab/mathjax2-extension": "~4.0.0-alpha.15",
"@jupyterlab/notebook": "^4.0.0-alpha.2",
"@jupyterlab/notebook": "^4.0.0-alpha.15",
"@jupyterlab/notebook-extension": "~4.0.0-alpha.15",
"@jupyterlab/pdf-extension": "~4.0.0-alpha.15",
"@jupyterlab/rendermime": "^4.0.0-alpha.2",
"@jupyterlab/rendermime": "^4.0.0-alpha.15",
"@jupyterlab/rendermime-extension": "~4.0.0-alpha.15",
"@jupyterlab/rendermime-interfaces": "^3.8.0-alpha.9",
"@jupyterlab/services": "^7.0.0-alpha.2",
"@jupyterlab/settingeditor": "^4.0.0-alpha.2",
"@jupyterlab/services": "^7.0.0-alpha.15",
"@jupyterlab/settingeditor": "^4.0.0-alpha.15",
"@jupyterlab/settingeditor-extension": "~4.0.0-alpha.15",
"@jupyterlab/settingregistry": "^4.0.0-alpha.2",
"@jupyterlab/settingregistry": "^4.0.0-alpha.15",
"@jupyterlab/shortcuts-extension": "~4.0.0-alpha.15",
"@jupyterlab/statedb": "^4.0.0-alpha.2",
"@jupyterlab/statusbar": "^4.0.0-alpha.2",
"@jupyterlab/statedb": "^4.0.0-alpha.15",
"@jupyterlab/statusbar": "^4.0.0-alpha.15",
"@jupyterlab/statusbar-extension": "~4.0.0-alpha.15",
"@jupyterlab/terminal": "^4.0.0-alpha.2",
"@jupyterlab/terminal-extension": "~4.0.0-alpha.15",
"@jupyterlab/theme-light-extension": "~4.0.0-alpha.15",
"@jupyterlab/toc-extension": "~6.0.0-alpha.15",
"@jupyterlab/tooltip": "^4.0.0-alpha.2",
"@jupyterlab/tooltip": "^4.0.0-alpha.15",
"@jupyterlab/tooltip-extension": "~4.0.0-alpha.15",
"@jupyterlab/translation": "~4.0.0-alpha.15",
"@jupyterlab/translation-extension": "~4.0.0-alpha.15",
Expand Down Expand Up @@ -133,7 +131,6 @@
"@jupyterlab/settingeditor-extension": "^4.0.0-alpha.15",
"@jupyterlab/shortcuts-extension": "^4.0.0-alpha.15",
"@jupyterlab/statusbar-extension": "^4.0.0-alpha.15",
"@jupyterlab/terminal-extension": "^4.0.0-alpha.15",
"@jupyterlab/theme-light-extension": "^4.0.0-alpha.15",
"@jupyterlab/toc-extension": "^6.0.0-alpha.15",
"@jupyterlab/tooltip-extension": "^4.0.0-alpha.15",
Expand Down Expand Up @@ -195,7 +192,6 @@
"@jupyterlab/settingregistry",
"@jupyterlab/statedb",
"@jupyterlab/statusbar",
"@jupyterlab/terminal",
"@jupyterlab/tooltip",
"@jupyterlab/translation",
"@jupyterlab/ui-components",
Expand Down Expand Up @@ -247,7 +243,6 @@
"@jupyterlab/settingeditor-extension",
"@jupyterlab/shortcuts-extension",
"@jupyterlab/statusbar-extension",
"@jupyterlab/terminal-extension",
"@jupyterlab/theme-light-extension",
"@jupyterlab/toc-extension",
"@jupyterlab/tooltip-extension",
Expand Down
7 changes: 2 additions & 5 deletions examples/federated/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@

# Turn off the Jupyter configuration system so configuration files on disk do
# not affect this app. This helps this app to truly be standalone.
# In jupyter-server v2 terminals are an extension. We need the config
# to load the extension
# os.environ["JUPYTER_NO_CONFIG"] = "1"
os.environ["JUPYTER_NO_CONFIG"] = "1"

with open(os.path.join(HERE, "package.json")) as fid:
version = json.load(fid)["version"]
Expand All @@ -24,8 +22,7 @@ def _jupyter_server_extension_points():

class ExampleApp(LabServerApp):
name = "lab"
# In jupyter-server v2 terminals are an extension
load_other_extensions = True
load_other_extensions = False
app_name = "JupyterLab Example App with Prebuilt Extensions"
app_settings_dir = os.path.join(HERE, "data", "application_settings")
app_version = version
Expand Down
3 changes: 1 addition & 2 deletions examples/filebrowser/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ class ExampleApp(LabServerApp):
extension_url = "/example"
default_url = "/example"
app_url = "/example"
# In jupyter-server v2 terminals are an extension.
load_other_extensions = True
load_other_extensions = False
name = __name__
app_name = "JupyterLab Example File Browser"
static_dir = os.path.join(HERE, "build")
Expand Down
2 changes: 1 addition & 1 deletion examples/terminal/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class ExampleHandler(ExtensionHandlerJinjaMixin, ExtensionHandlerMixin, JupyterH

def get(self):
"""Get the main page for the application's interface."""
available = self.settings["terminals_available"]
available = self.settings.get("terminals_available", False)
config_data = {
# Use camelCase here, since that's what the lab components expect
"appVersion": version,
Expand Down
8 changes: 0 additions & 8 deletions packages/extensionmanager-extension/examples/listings/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,6 @@ def init_webapp(self):
]
self.web_app.add_handlers(".*$", default_handlers)

def start(self):
settings = self.web_app.settings

# By default, make terminals available.
settings.setdefault("terminals_available", True)

super().start()


if __name__ == "__main__":
ListingsApp.launch_instance()

0 comments on commit a059144

Please sign in to comment.