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 for building with jupyterlab4 #70

Open
wants to merge 6 commits into
base: main
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
16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,12 @@
"build:prod": "jlpm run build:lib && jlpm run build:labextension",
"build:labextension": "jupyter labextension build .",
"build:labextension:dev": "jupyter labextension build --development True .",
"build:lib": "tsc",
"build:lib": "jlpm run copy && tsc",
"clean": "jlpm run clean:lib",
"clean:lib": "rimraf lib tsconfig.tsbuildinfo",
"clean:labextension": "rimraf jupyterlab-lmod/labextension",
"clean:all": "jlpm run clean:lib && jlpm run clean:labextension",
"copy": "mkdir -p lib/src && cp -r src/assets lib/src",
"eslint": "eslint . --ext .ts,.tsx --fix",
"eslint:check": "eslint . --ext .ts,.tsx",
"eslint:check:junit": "eslint . --ext .ts,.tsx --format junit --output-file linting.xml",
Expand All @@ -61,19 +62,18 @@
"watch:labextension": "jupyter labextension watch ."
},
"dependencies": {
"@jupyterlab/application": "^2.0.0 || ^3.0.0",
"@jupyterlab/launcher": "^2.0.0 || ^3.0.0",
"@jupyterhub/jupyter-server-proxy": "^4.1.0"
"@jupyterhub/jupyter-server-proxy": "^4.1.0",
"@jupyterlab/application": "^4.0.0",
"@jupyterlab/launcher": "^4.0.0"
},
"devDependencies": {
"@jupyterlab/builder": "^3.6.1",
"@jupyterlab/builder": "^4.2.0",
"npm-run-all": "^4.1.5",
"rimraf": "~3.0.2",
"typescript": "~4.1.3"
"rimraf": "~5.0.7",
"typescript": "~5.4.5"
},
"jupyterlab": {
"extension": true,
"schemaDir": "schema",
"outputDir": "jupyterlmod/labextension"
}
}
8 changes: 4 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ requires = [
"hatch-jupyter-builder >=0.5",
"hatch-nodejs-version",
"hatchling >=1.4.0",
"jupyterlab >=3.4.7,<4.0.0",
"jupyterlab >=4.0.0",
]
build-backend = "hatchling.build"

Expand Down Expand Up @@ -53,8 +53,8 @@ packages = ["jupyterlmod", "module"]
"jupyterlmod/etc/jupyterlmod_serverextension.json" = "etc/jupyter/jupyter_notebook_config.d/jupyterlmod_serverextension.json"
"jupyterlmod/etc/jupyterlmod_jupyterserverextension.json" = "etc/jupyter/jupyter_server_config.d/jupyterlmod_jupyterserverextension.json"
"jupyterlmod/etc/jupyterlmod_nbextension.json" = "etc/jupyter/nbconfig/tree.d/jupyterlmod_nbextension.json"
"jupyterlmod/labextension" = "share/jupyter/labextensions/@jupyterlab/jupyterlab-lmod"
"install.json" = "share/jupyter/labextensions/@jupyterlab/jupyterlab-lmod/install.json"
"jupyterlmod/labextension" = "share/jupyter/labextensions/@cmd-ntrf/jupyterlab-lmod"
"install.json" = "share/jupyter/labextensions/@cmd-ntrf/jupyterlab-lmod/install.json"

[tool.hatch.version]
source = "nodejs"
Expand Down Expand Up @@ -89,7 +89,7 @@ field = [
]

[tool.tbump.version]
current = "4.0.3"
current = "5.0.0"
regex = "(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)((?P<channel>a|b|rc|.dev)(?P<release>\\d+))?"

[tool.tbump.git]
Expand Down
58 changes: 58 additions & 0 deletions src/assets/lmod.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
68 changes: 68 additions & 0 deletions src/assets/tmod.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 22 additions & 11 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,22 @@ import { PageConfig } from '@jupyterlab/coreutils';

import { Module } from '../jupyterlmod/static/module.js';

import * as serverproxy from '@jupyterlab/server-proxy';
import * as serverproxy from '@jupyterhub/jupyter-server-proxy';

import { LabIcon } from '@jupyterlab/ui-components';

import lmodIconSvg from './assets/lmod.svg';
import tmodIconSvg from './assets/tmod.svg';
export const jplmodIcons = {
lmod: new LabIcon({
name: 'jupyter_lmod:lmod_logo',
svgstr: lmodIconSvg
}),
tmod: new LabIcon({
name: 'jupyter_lmod:tmod_logo',
svgstr: tmodIconSvg
})
};

function createModuleItem(label: string, button: string) {
const module_list_line = document.createElement('li');
Expand Down Expand Up @@ -119,7 +134,7 @@ class ModuleWidget extends Widget {
super();

this.id = 'module-jupyterlab';
this.title.caption = 'Softwares';
this.title.caption = 'Software Modules';
this.addClass('jp-Module');

const search_div = document.createElement('div');
Expand Down Expand Up @@ -187,14 +202,10 @@ class ModuleWidget extends Widget {
public setIcon() {
Promise.all([moduleAPI.system()])
.then(values => {
const modulesys = values[0];
console.log("Module system found:", modulesys)
// Set icon based on module system
if (modulesys === 'lmod') {
this.title.iconClass = 'jp-LmodIcon jp-SideBar-tabIcon'
} else {
this.title.iconClass = 'jp-TmodIcon jp-SideBar-tabIcon'
}
const modulesys = values[0];
console.log("Module system found:", modulesys)
// Set icon based on module system
this.title.icon = jplmodIcons[modulesys];
});
}

Expand Down Expand Up @@ -324,7 +335,7 @@ function activate(

setup_proxy_commands(app, restorer);

restorer.add(widget, 'module-sessions');
restorer.add(widget, 'module-sessions');
app.shell.add(widget, 'left', { rank: 1000 });
widget.update();
console.log('JupyterFrontEnd extension lmod/tmod is activated!');
Expand Down
4 changes: 4 additions & 0 deletions src/svg.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
declare module '*.svg' {
const value: string;
export default value;
}
Loading