Skip to content

Commit 588f154

Browse files
author
Zerline
committed
Added 'plugin.ts' for a valid Jupyterlab extension.
1 parent a38343c commit 588f154

File tree

4 files changed

+55
-1
lines changed

4 files changed

+55
-1
lines changed

MANIFEST.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ include js/webpack.config.js
99
include sage_combinat_widgets/labextension/*.tgz
1010

1111
# Documentation
12+
include demo_GridViewWidget.ipynb
1213
graft docs
1314
exclude docs/\#*
1415
prune docs/build

js/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
"webpack-cli": "^3.3.6"
5050
},
5151
"dependencies": {
52+
"@phosphor/application": "^1.6.0",
5253
"@jupyter-widgets/base": "^2.0.1",
5354
"@jupyter-widgets/controls": "^1.5.2",
5455
"@types/node": "^12.6.9",
@@ -61,6 +62,6 @@
6162
"webpack": "^4.39.1"
6263
},
6364
"jupyterlab": {
64-
"extension": "lib/labplugin"
65+
"extension": "lib/plugin"
6566
}
6667
}

js/src/plugin.ts

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
// Copyright (c) Odile Bénassy, Nicolas Thiéry
2+
// Distributed under the terms of the Modified BSD License.
3+
4+
import {
5+
Application, IPlugin
6+
} from '@phosphor/application';
7+
8+
import {
9+
Widget
10+
} from '@phosphor/widgets';
11+
12+
import {
13+
IJupyterWidgetRegistry
14+
} from '@jupyter-widgets/base';
15+
16+
import * as widgetExports from './singleton_widgets';
17+
18+
import {
19+
MODULE_NAME, MODULE_VERSION
20+
} from './version';
21+
22+
const EXTENSION_ID = 'sage-combinat-widgets:plugin';
23+
24+
/**
25+
* The example plugin.
26+
*/
27+
const sageCombinatWidgetsPlugin: IPlugin<Application<Widget>, void> = {
28+
id: EXTENSION_ID,
29+
requires: [IJupyterWidgetRegistry],
30+
activate: activateWidgetExtension,
31+
autoStart: true
32+
};
33+
34+
export default sageCombinatWidgetsPlugin;
35+
36+
37+
/**
38+
* Activate the widget extension.
39+
*/
40+
function activateWidgetExtension(app: Application<Widget>, registry: IJupyterWidgetRegistry): void {
41+
registry.registerWidget({
42+
name: MODULE_NAME,
43+
version: MODULE_VERSION,
44+
exports: widgetExports,
45+
});
46+
}

setup.cfg

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[bdist_wheel]
2+
universal=1
3+
4+
[metadata]
5+
description-file = README.rst
6+
license_file = LICENSE

0 commit comments

Comments
 (0)