Skip to content

Commit d574f69

Browse files
authored
Merge pull request #647 from bollwyvl/gh-644-retro
Start RetroLab support
2 parents 8b286eb + 2286f70 commit d574f69

File tree

8 files changed

+61
-31
lines changed

8 files changed

+61
-31
lines changed

.binder/jupyter_config.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"LabApp": {
3+
"collaborative": true
4+
}
5+
}

.binder/postBuild

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/usr/bin/env bash
2+
jlpm --prefer-offline --ignore-optional --ignore-scripts
3+
4+
jlpm build
5+
6+
IPP_DISABLE_JS=1 python -m pip install -e .[test,benchmark]
7+
8+
jupyter serverextension enable --sys-prefix --py ipyparallel
9+
jupyter serverextension list
10+
11+
jupyter server extension enable --sys-prefix --py ipyparallel
12+
jupyter server extension list
13+
14+
jupyter nbextension install --symlink --sys-prefix --py ipyparallel
15+
jupyter nbextension enable --sys-prefix --py ipyparallel
16+
jupyter nbextension list
17+
18+
jlpm install:extension
19+
jupyter labextension list

.binder/requirements.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
ipywidgets
2+
jupyterlab >=3.2.4
3+
jupyterlab-link-share
4+
matplotlib
5+
networkx
6+
pidigits
7+
requests
8+
retrolab >=0.3.13
9+
wordfreq

ci/ssh/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ RUN --mount=type=cache,target=/var/cache/apt \
77

88
ENV MAMBA_ROOT_PREFIX=/opt/conda
99
ENV PATH=$MAMBA_ROOT_PREFIX/bin:$PATH
10+
ENV IPP_DISABLE_JS=1
1011
RUN wget -qO- https://micro.mamba.pm/api/micromamba/linux-64/latest | tar -xvj bin/micromamba \
1112
&& mv bin/micromamba /usr/local/bin/micromamba
1213

docs/environment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ dependencies:
1111
- nbsphinx
1212
- myst-parser
1313

14-
- matplotlib
14+
- matplotlib-base
1515
# nodejs needed for extension build
1616
- nodejs

lab/src/index.ts

Lines changed: 23 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,22 @@
11
// IPython Parallel Lab extension derived from dask-labextension@f6141455d770ed7de564fc4aa403b9964cd4e617
22
// License: BSD-3-Clause
33

4+
import { PageConfig } from "@jupyterlab/coreutils";
5+
6+
import { TabPanel } from "@lumino/widgets";
7+
48
import {
59
ILabShell,
6-
ILayoutRestorer,
710
JupyterFrontEnd,
811
JupyterFrontEndPlugin,
912
} from "@jupyterlab/application";
1013

11-
import {
12-
ICommandPalette,
13-
ISessionContext,
14-
IWidgetTracker,
15-
} from "@jupyterlab/apputils";
14+
import { ISessionContext, IWidgetTracker } from "@jupyterlab/apputils";
1615

1716
import { CodeEditor } from "@jupyterlab/codeeditor";
1817

1918
import { ConsolePanel, IConsoleTracker } from "@jupyterlab/console";
2019

21-
import { IMainMenu } from "@jupyterlab/mainmenu";
22-
2320
import { ISettingRegistry } from "@jupyterlab/settingregistry";
2421

2522
import { IStateDB } from "@jupyterlab/statedb";
@@ -41,28 +38,22 @@ import { IClusterModel, ClusterManager } from "./clusters";
4138
import { Sidebar } from "./sidebar";
4239

4340
import "../style/index.css";
41+
4442
import logoSvgStr from "../style/logo.svg";
4543

4644
import { CommandIDs } from "./commands";
4745

4846
const PLUGIN_ID = "ipyparallel-labextension:plugin";
47+
const CATEGORY = "IPython Parallel";
4948

5049
/**
5150
* The IPython Parallel extension.
5251
*/
5352
const plugin: JupyterFrontEndPlugin<void> = {
5453
activate,
5554
id: PLUGIN_ID,
56-
requires: [
57-
ICommandPalette,
58-
IConsoleTracker,
59-
ILabShell,
60-
ILayoutRestorer,
61-
IMainMenu,
62-
INotebookTracker,
63-
ISettingRegistry,
64-
IStateDB,
65-
],
55+
requires: [IConsoleTracker, INotebookTracker, ISettingRegistry, IStateDB],
56+
optional: [ILabShell],
6657
autoStart: true,
6758
};
6859

@@ -76,17 +67,17 @@ export default plugin;
7667
*/
7768
async function activate(
7869
app: JupyterFrontEnd,
79-
commandPalette: ICommandPalette,
8070
consoleTracker: IConsoleTracker,
81-
labShell: ILabShell,
82-
restorer: ILayoutRestorer,
83-
mainMenu: IMainMenu,
8471
notebookTracker: INotebookTracker,
8572
settingRegistry: ISettingRegistry,
86-
state: IStateDB
73+
state: IStateDB,
74+
labShell?: ILabShell | null
8775
): Promise<void> {
8876
const id = "ipp-cluster-launcher";
8977

78+
const isLab = !!labShell;
79+
const isRetroTree = PageConfig.getOption("retroPage") == "tree";
80+
9081
const clientCodeInjector = (model: IClusterModel) => {
9182
const editor = Private.getCurrentEditor(
9283
app,
@@ -112,9 +103,16 @@ async function activate(
112103
});
113104

114105
// sidebar.title.iconClass = 'ipp-Logo jp-SideBar-tabIcon';
115-
sidebar.title.caption = "IPython Parallel";
116106

117-
labShell.add(sidebar, "left", { rank: 200 });
107+
if (isLab) {
108+
labShell.add(sidebar, "left", { rank: 200 });
109+
sidebar.title.caption = CATEGORY;
110+
} else if (isRetroTree) {
111+
const tabPanel = app.shell.currentWidget as TabPanel;
112+
tabPanel.addWidget(sidebar);
113+
tabPanel.tabBar.addTab(sidebar.title);
114+
sidebar.title.label = CATEGORY;
115+
}
118116

119117
sidebar.clusterManager.activeClusterChanged.connect(async () => {
120118
const active = sidebar.clusterManager.activeCluster;

lab/style/index.css

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,6 @@
1717
* Rules related to the cluster manager.
1818
*/
1919

20-
.ipp-ClusterManager {
21-
border-top: 6px solid var(--jp-toolbar-border-color);
22-
}
23-
2420
.ipp-ClusterManager .jp-Toolbar {
2521
align-items: center;
2622
}

setup.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def run(self):
6363

6464
data_files = get_data_files(data_files_spec)
6565

66-
builder = npm_builder(build_cmd="build:prod")
66+
builder = npm_builder(build_cmd="build:prod", npm="jlpm")
6767
if os.environ.get("IPP_DISABLE_JS") == "1":
6868
print("Skipping js installation")
6969
cmdclass = {}
@@ -123,6 +123,8 @@ def run(self):
123123
"nbext": ["notebook", "jupyter_server"],
124124
"serverextension": ["jupyter_server"],
125125
"labextension": ["jupyter_server", "jupyterlab>=3"],
126+
"retroextension": ["jupyter_server", "retrolab"],
127+
"benchmark": ["asv"],
126128
"test": [
127129
"pytest",
128130
"pytest-cov",

0 commit comments

Comments
 (0)