Skip to content
Draft
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
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1

- name: Install dependencies
run: python -m pip install -U jupyterlab~=3.1
run: python -m pip install -U jupyterlab~=4.5.0rc0

- name: Lint the extension
run: |
Expand Down Expand Up @@ -77,7 +77,7 @@ jobs:
sudo rm -rf $(which node)
sudo rm -rf $(which node)

pip install "jupyterlab~=3.1" jupyterlab_ui_profiler*.whl setuptools
pip install "jupyterlab~=4.5.0rc0" jupyterlab_ui_profiler*.whl setuptools


jupyter labextension list
Expand Down Expand Up @@ -107,7 +107,7 @@ jobs:
- name: Install the extension
run: |
set -eux
python -m pip install "jupyterlab~=3.1" jupyterlab_ui_profiler*.whl
python -m pip install "jupyterlab~=4.5.0rc0" jupyterlab_ui_profiler*.whl

- name: Install dependencies
working-directory: ui-tests
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/update-integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ jobs:
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1

- name: Install dependencies
run: python -m pip install -U jupyterlab~=3.1
run: python -m pip install -U jupyterlab~=4.5.0rc0

- name: Install extension
run: |
Expand Down
1 change: 1 addition & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodeLinker: node-modules
6 changes: 3 additions & 3 deletions binder/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ channels:

dependencies:
# runtime dependencies
- python >=3.8,<3.9.0a0
- jupyterlab >=3,<4.0.0a0
- python >=3.10,<3.14.0a0
- jupyterlab >=4.5.0rc,<5.0.0a0
# labextension build dependencies
- nodejs >=14,<15
- nodejs >=22,<24
- pip
- wheel
# additional packages for demos
Expand Down
34 changes: 8 additions & 26 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,46 +1,28 @@
const jestJupyterLab = require('@jupyterlab/testutils/lib/jest-config');

const esModules = [
'@codemirror',
'@jupyter/ydoc',
'@jupyterlab/',
'lib0',
'y\\-protocols',
'y\\-websocket',
'nanoid',
'vscode-ws-jsonrpc',
'y-protocols',
'y-websocket',
'yjs'
].join('|');

const jlabConfig = jestJupyterLab(__dirname);

const {
moduleFileExtensions,
moduleNameMapper,
preset,
setupFilesAfterEnv,
setupFiles,
testPathIgnorePatterns,
transform
} = jlabConfig;
const baseConfig = jestJupyterLab(__dirname);

module.exports = {
moduleFileExtensions,
moduleNameMapper,
preset,
setupFilesAfterEnv,
setupFiles,
testPathIgnorePatterns,
transform,
...baseConfig,
automock: false,
collectCoverageFrom: [
'src/**/*.{ts,tsx}',
'!src/**/*.d.ts',
'!src/**/.ipynb_checkpoints/*'
],
coverageDirectory: 'coverage',
coverageReporters: ['lcov', 'text'],
globals: {
'ts-jest': {
tsconfig: 'tsconfig.json'
}
},
testRegex: 'src/.*/.*.spec.ts[x]?$',
transformIgnorePatterns: [`/node_modules/(?!${esModules}).+`]
};
63 changes: 35 additions & 28 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,39 +56,46 @@
"watch:labextension": "jupyter labextension watch ."
},
"dependencies": {
"@jupyterlab/application": "^3.1.0",
"@jupyterlab/json-extension": "^3.5.0"
"@jupyterlab/application": "^4.4.10",
"@jupyterlab/json-extension": "^4.4.10"
},
"devDependencies": {
"@babel/core": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"@jupyterlab/apputils": "^3.1.0",
"@jupyterlab/builder": "^3.1.0",
"@jupyterlab/filebrowser": "^3.5.0",
"@jupyterlab/launcher": "^3.1.0",
"@jupyterlab/testutils": "^3.6.0",
"@lumino/datagrid": "^0.36.4",
"@lumino/widgets": "^1.34.1",
"@rjsf/core": "^3.0.0",
"@types/jest": "^26.0.0",
"@types/json-schema": "^7.0.7",
"@typescript-eslint/eslint-plugin": "^4.8.1",
"@typescript-eslint/parser": "^4.8.1",
"eslint": "^7.14.0",
"eslint-config-prettier": "^6.15.0",
"eslint-plugin-prettier": "^3.1.4",
"jest": "^26.0.0",
"json-schema-to-typescript": "^8.0.0",
"@babel/core": "^7.28.5",
"@babel/preset-env": "^7.28.5",
"@jupyterlab/apputils": "^4.5.10",
"@jupyterlab/builder": "^4.4.10",
"@jupyterlab/filebrowser": "^4.4.10",
"@jupyterlab/launcher": "^4.4.10",
"@jupyterlab/testutils": "^4.4.10",
"@jupyterlab/ui-components": "^4.4.10",
"@lumino/datagrid": "^2.5.2",
"@lumino/widgets": "^2.7.1",
"@rjsf/core": "^5.13.4",
"@rjsf/validator-ajv8": "^5.13.4",
"@types/jest": "^30.0.0",
"@types/json-schema": "^7.0.15",
"@typescript-eslint/eslint-plugin": "~6.13.2",
"@typescript-eslint/parser": "~6.13.2",
"eslint": "~8.55.0",
"eslint-config-prettier": "~9.1.0",
"eslint-plugin-prettier": "~5.0.1",
"jest": "^29.2.0",
"json-schema-to-typescript": "^8.2.0",
"npm-run-all": "^4.1.5",
"prettier": "^2.1.1",
"prettier": "~3.0.0",
"rimraf": "^3.0.2",
"stylelint": "^14.3.0",
"stylelint": "^15.10.1",
"stylelint-config-prettier": "^9.0.3",
"stylelint-config-recommended": "^6.0.0",
"stylelint-config-standard": "~24.0.0",
"stylelint-prettier": "^2.0.0",
"ts-jest": "^26.0.0",
"typescript": "~4.2.3"
"stylelint-config-recommended": "^13.0.0",
"stylelint-config-standard": "~34.0.0",
"stylelint-prettier": "^4.0.0",
"ts-jest": "^29.1.0",
"typescript": "~5.5.4"
},
"resolutions": {
"@rjsf/validator-ajv8": "5.14.3",
"@rjsf/core": "5.14.3",
"@rjsf/utils": "5.14.3"
},
"sideEffects": [
"style/*.css",
Expand Down
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
[build-system]
requires = ["hatchling>=1.4.0", "jupyterlab>=3.4.7,<4.0.0", "hatch-nodejs-version"]
requires = ["hatchling>=1.4.0", "jupyterlab>=4.0.0,<5.0.0", "hatch-nodejs-version"]
build-backend = "hatchling.build"

[project]
name = "jupyterlab-ui-profiler"
readme = "README.md"
license = { file = "LICENSE" }
requires-python = ">=3.7"
requires-python = ">=3.9"
classifiers = [
"Intended Audience :: Developers",
"Framework :: Jupyter",
Expand Down Expand Up @@ -88,7 +88,7 @@ build_dir = "jupyterlab_ui_profiler/labextension"
version_cmd = "hatch version"

[tool.jupyter-releaser.hooks]
before-build-npm = ["python -m pip install jupyterlab~=3.1", "jlpm", "jlpm build:prod"]
before-build-npm = ["python -m pip install jupyterlab~=4.5.0rc0", "jlpm", "jlpm build:prod"]
before-build-python = ["jlpm clean:all"]

[tool.check-wheel-contents]
Expand Down
6 changes: 3 additions & 3 deletions readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ version: 2
sphinx:
configuration: docs/source/conf.py
build:
os: ubuntu-20.04
os: ubuntu-24.04
tools:
python: "3.8"
nodejs: "14"
python: "3.10"
nodejs: "20"
python:
install:
- method: pip
Expand Down
89 changes: 87 additions & 2 deletions src/scenarios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ import type {
TabScenarioOptions,
ScrollScenarioOptions,
DebuggerScenarioOptions,
CreateCellsScenarioOptions
CreateCellsScenarioOptions,
CustomScenarioOptions
} from './types';

import scenarioOptionsSchema from './schema/scenario-base.json';
Expand All @@ -33,6 +34,7 @@ import scenarioDebuggerOptionsSchema from './schema/scenario-debugger.json';
import scenarioSidebarsSchema from './schema/scenario-sidebars.json';
import scenarioScrollSchema from './schema/scenario-scroll.json';
import scenarioCreateCellsSchema from './schema/scenario-create-cells.json';
import scenarioCustomSchema from './schema/scenario-custom.json';

async function switchMainMenu(jupyterApp: JupyterFrontEnd) {
for (const menu of ['edit', 'view', 'run', 'kernel', 'settings', 'help']) {
Expand Down Expand Up @@ -537,6 +539,88 @@ export class CreateCellsScenario
}
}

export class CustomScenario implements IScenario {
id = 'custom';
name = 'Custom Scenario';
configSchema = scenarioCustomSchema as any as JSONSchema7;
options: CustomScenarioOptions | undefined;

constructor(protected jupyterApp: JupyterFrontEnd) {
jupyterApp.restored.then(async () => {
const commandSchema = this.configSchema.definitions!['command'] as any;
const commandIds = jupyterApp.commands.listCommands();
commandSchema['oneOf'] = await Promise.all(
commandIds.map(async commandId => {
const commandSchema =
await jupyterApp.commands.describedBy(commandId);
return {
type: 'object',
title: `Arguments for ${commandId}`,
properties: {
id: {
type: 'string',
const: commandId
},
args: commandSchema['args']
? commandSchema['args']
: {
type: 'object',
additionalProperties: true
}
}
};
})
);
commandSchema['properties']['id']['oneOf'] = commandIds.map(commandId => {
// https://github.com/jupyterlab/ui-profiler/pull/60
const title =
commandId === 'fileeditor:change-font-size'
? 'Change font size'
: jupyterApp.commands.label(commandId) || commandId;
return {
const: commandId,
title
};
});
});
}

setOptions(options: CustomScenarioOptions): void {
this.options = options;
}

async setupSuite(): Promise<void> {
if (!this.options) {
throw new Error('Options not set for scenario.');
}
for (const command of this.options.setupCommands) {
await this.jupyterApp.commands.execute(command.id, command.args);
await layoutReady();
}
await layoutReady();
}

async run(): Promise<void> {
if (!this.options) {
throw new Error('Options not set for scenario.');
}
for (const command of this.options.commands) {
await this.jupyterApp.commands.execute(command.id, command.args);
await layoutReady();
}
}

async cleanup(): Promise<void> {
if (!this.options) {
throw new Error('Options not set for scenario.');
}
for (const command of this.options.cleanupCommands) {
await this.jupyterApp.commands.execute(command.id, command.args);
await layoutReady();
}
}
}

export class ScrollScenario
extends SingleEditorScenario<ScrollScenarioOptions>
implements IScenario
Expand Down Expand Up @@ -690,7 +774,8 @@ export const plugin: JupyterFrontEndPlugin<void> = {
new CompleterScenario(app),
new ScrollScenario(app),
new DebuggerScenario(app),
new CreateCellsScenario(app)
new CreateCellsScenario(app),
new CustomScenario(app)
].map(scenario => profiler.addScenario(scenario));
}
};
3 changes: 2 additions & 1 deletion src/schema/benchmark-execution.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@
"minimum": 1,
"default": 500
}
}
},
"required": ["repeats"]
}
10 changes: 9 additions & 1 deletion src/schema/benchmark-rule-group.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,13 @@
"type": "string",
"default": ""
}
}
},
"required": [
"repeats",
"skipPattern",
"minBlocks",
"maxBlocks",
"sheetRandomizations",
"includePattern"
]
}
8 changes: 7 additions & 1 deletion src/schema/benchmark-rule-usage.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,11 @@
"type": "string",
"default": ""
}
}
},
"required": [
"repeats",
"skipPattern",
"excludeMatchPattern",
"includePattern"
]
}
3 changes: 2 additions & 1 deletion src/schema/benchmark-rule.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@
"type": "string",
"default": ""
}
}
},
"required": ["repeats", "skipPattern", "includePattern"]
}
3 changes: 2 additions & 1 deletion src/schema/benchmark-sheet.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@
"type": "string",
"default": ""
}
}
},
"required": ["repeats", "includePattern"]
}
Loading
Loading