Skip to content

Commit 5395245

Browse files
authored
Merge pull request #249 from minjk-bl/devops
Devops for v3.0.0
2 parents 9d93210 + 825a80a commit 5395245

21 files changed

+15900
-14626
lines changed

jupyterlab/.gitignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
*.bundle.*
22
node_modules/
3+
*.log
4+
.eslintcache
5+
.stylelintcache
36
*.egg-info/
47
.ipynb_checkpoints
58
*.tsbuildinfo
69
visualpython/labextension
10+
jupyterlab-visualpython/labextension
11+
# Version file is handled by hatchling
12+
jupyterlab-visualpython/_version.py
713

814
# Created by https://www.gitignore.io/api/python
915
# Edit at https://www.gitignore.io/?templates=python
@@ -54,6 +60,7 @@ htmlcov/
5460
.coverage.*
5561
.cache
5662
nosetests.xml
63+
coverage/
5764
coverage.xml
5865
*.cover
5966
.hypothesis/
@@ -108,3 +115,6 @@ dmypy.json
108115

109116
# OSX files
110117
.DS_Store
118+
119+
# Yarn cache
120+
.yarn/

jupyterlab/.yarnrc.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
nodeLinker: node-modules

jupyterlab/binder/postBuild

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env python3
2-
""" perform a development install of visualpython
2+
""" perform a development install of jupyterlab-visualpython
33
44
On Binder, this will run _after_ the environment has been fully created from
55
the environment.yml in this directory.
@@ -31,6 +31,7 @@ _(sys.executable, "-m", "pip", "check")
3131

3232
# install the labextension
3333
_(sys.executable, "-m", "pip", "install", "-e", ".")
34+
_(sys.executable, "-m", "jupyter", "labextension", "develop", "--overwrite", ".")
3435

3536
# verify the environment the extension didn't break anything
3637
_(sys.executable, "-m", "pip", "check")
@@ -42,5 +43,5 @@ _("jupyter", "server", "extension", "list")
4243
_("jupyter", "labextension", "list")
4344

4445

45-
print("JupyterLab with visualpython is ready to run with:\n")
46+
print("JupyterLab with jupyterlab-visualpython is ready to run with:\n")
4647
print("\tjupyter lab\n")

jupyterlab/lib/VpPanel.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ define([
88
'jquery-ui',
99
'jquery-ui-css',
1010
'codemirror/lib/codemirror',
11-
// __VP_CSS_LOADER__('codemirror/lib/codemirror'), // INTEGRATION: unified version of css loader
11+
'vp_base/lib/codemirror/lib/codemirror.css', // INTEGRATION: unified version of css loader
1212
'vp_base/js/loadVisualpython',
1313
'vp_base/js/com/com_Config'
1414
], function(
@@ -17,7 +17,7 @@ define([
1717
text, css, $,
1818
ui, uiCss,
1919
codemirror,
20-
// cmCss,
20+
cmCss,
2121
loadVisualpython, com_Config) {
2222

2323
const {
@@ -41,9 +41,9 @@ define([
4141
this.app = app;
4242
this.vpFrame = loadVisualpython.initVisualpython();
4343

44-
this.id = 'visualpython_vpPanel';
44+
this.id = 'jupyterlab-visualpython:panel';
4545
// LabIcon with svg : @jupyterlab/ui-components/lib/icon/labicon.js
46-
this.title.icon = new LabIcon({ name: 'visualpython:toggle', svgstr: vpIcon.default });
46+
this.title.icon = new LabIcon({ name: 'jupyterlab-visualpython:toggle-icon', svgstr: vpIcon });
4747
this.title.caption = 'Visual Python';
4848

4949
// register node using jquery to element

jupyterlab/lib/index.js

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,17 @@ global.__VP_RAW_LOADER__ = function(path) {
1414
return path;
1515
}
1616

17+
const vpId = 'jupyterlab-visualpython:plugin';
18+
19+
const { ICommandPalette } = require('@jupyterlab/apputils');
20+
1721
global.$ = $;
1822
global.vpBase = path.resolve(__dirname, "lib") + '/';
1923
module.exports = [{
20-
id: 'visualpython:entry',
24+
id: vpId,
2125
autoStart: true,
22-
activate: function (app) {
26+
requires: [ICommandPalette],
27+
activate: function (app, palette) {
2328
console.log(
2429
'JupyterLab extension visualpython is activated!'
2530
);
@@ -35,5 +40,30 @@ module.exports = [{
3540
// Add vp to the right area:
3641
var vpPanel = new VpPanel(app);
3742
app.shell.add(vpPanel, 'right', { rank: 900, type: 'Visual Python' });
43+
44+
// Add toggle button
45+
let isVpVisible = app.name !== 'JupyterLab'; // compatible for notebook 7.x (hidden for jupyterlab)
46+
let toggleCommand = 'jupyterlab-visualpython:toggle-panel';
47+
let vpLabel = isVpVisible?'Toggle Visual Python':'';
48+
app.commands.addCommand(toggleCommand, {
49+
isEnabled: () => isVpVisible,
50+
isVisible: () => isVpVisible,
51+
iconClass: 'jp-vp-icon',
52+
iconLabel: vpLabel,
53+
execute: () => {
54+
if (app.shell.rightCollapsed === true || $('#vp_wrapper').is(':visible') === false) {
55+
app.shell.activateById('vp_wrapper');
56+
} else {
57+
app.shell.collapseRight();
58+
}
59+
}
60+
});
61+
62+
// Add command palette
63+
palette.addItem({
64+
command: toggleCommand,
65+
category: 'Visual Python',
66+
label: 'Toggle Visual Python'
67+
});
3868
}
3969
}];

0 commit comments

Comments
 (0)