Skip to content

Commit 365ac0e

Browse files
authored
Merge pull request #69 from ianhi/get-working-tests
jlab2 support + fix tests
2 parents df9c9cf + 05af45e commit 365ac0e

File tree

10 files changed

+28
-15
lines changed

10 files changed

+28
-15
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ cache:
1414
- $HOME/.npm
1515
before_install:
1616
- pip install -U pip setuptools
17-
- nvm install 8
17+
- nvm install 12
1818
- pip install cookiecutter
1919
install:
2020
- pushd $(mktemp -d)

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ When developing your extensions, you need to manually enable your extensions wit
5454
notebook / lab frontend. For lab, this is done by the command:
5555

5656
```
57+
jupyter labextension install @jupyter-widgets/jupyterlab-manager --no-build
5758
jupyter labextension install .
5859
```
5960

{{cookiecutter.github_project_name}}/.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ cache:
2727
- $HOME/.npm
2828
before_install:
2929
- pip install -U pip setuptools
30-
- nvm install 8
30+
- nvm install 12
3131
- |
3232
if [[ $GROUP == python ]]; then
3333
pip install codecov
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
.custom-widget {
2-
background-color: blue;
2+
background-color: lightseagreen;
3+
padding: 0px 2px;
34
}

{{cookiecutter.github_project_name}}/docs/source/conf.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
'sphinx.ext.napoleon',
3030
'sphinx.ext.todo',
3131
'nbsphinx',
32-
'jupyter_sphinx.embed_widgets',
32+
'jupyter_sphinx.execute',
3333
'nbsphinx_link',
3434
]
3535

@@ -197,12 +197,13 @@
197197
#
198198
nbsphinx_allow_errors = True # exception ipstruct.py ipython_genutils
199199

200+
from sphinx.util import logging
201+
logger = logging.getLogger(__name__)
200202

201203
def setup(app):
202-
app.setup_extension('jupyter_sphinx.embed_widgets')
203204
def add_scripts(app):
204205
for fname in ['helper.js', 'embed-bundle.js']:
205206
if not os.path.exists(os.path.join(here, '_static', fname)):
206-
app.warn('missing javascript file: %s' % fname)
207-
app.add_javascript(fname)
208-
app.connect('builder-inited', add_scripts)
207+
logger.warning('missing javascript file: %s' % fname)
208+
app.add_js_file(fname)
209+
app.connect('builder-inited', add_scripts)

{{cookiecutter.github_project_name}}/examples/introduction.ipynb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
"metadata": {},
2323
"outputs": [],
2424
"source": [
25-
"w = {{ cookiecutter.python_package_name }}.ExampleWidget()"
25+
"w = {{ cookiecutter.python_package_name }}.ExampleWidget()\n",
26+
"w"
2627
]
2728
},
2829
{

{{cookiecutter.github_project_name}}/package.json

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
"watch:nbextension": "webpack --watch"
5050
},
5151
"dependencies": {
52-
"@jupyter-widgets/base": "^1.1.10 || ^2"
52+
"@jupyter-widgets/base": "^1.1.10 || ^2 || ^3"
5353
},
5454
"devDependencies": {
5555
"@phosphor/application": "^1.6.0",
@@ -58,24 +58,26 @@
5858
"@types/mocha": "^5.2.5",
5959
"@types/node": "^10.11.6",
6060
"@types/webpack-env": "^1.13.6",
61+
"acorn": "^7.2.0",
6162
"css-loader": "^3.2.0",
6263
"expect.js": "^0.3.1",
6364
"fs-extra": "^7.0.0",
64-
"karma": "^3.0.0",
65+
"karma": "^3.1.0",
6566
"karma-chrome-launcher": "^2.2.0",
6667
"karma-firefox-launcher": "^1.1.0",
6768
"karma-ie-launcher": "^1.0.0",
6869
"karma-mocha": "^1.3.0",
6970
"karma-mocha-reporter": "^2.2.5",
70-
"karma-typescript": "^3.0.13",
71+
"karma-typescript": "^5.0.3",
72+
"karma-typescript-es6-transform": "^5.0.3",
7173
"mkdirp": "^0.5.1",
7274
"mocha": "^5.2.0",
7375
"npm-run-all": "^4.1.3",
7476
"rimraf": "^2.6.2",
7577
"source-map-loader": "^0.2.4",
7678
"style-loader": "^1.0.0",
7779
"ts-loader": "^5.2.1",
78-
"typescript": "~3.1.2",
80+
"typescript": "~3.8",
7981
"webpack": "^4.20.2",
8082
"webpack-cli": "^3.1.2"
8183
},

{{cookiecutter.github_project_name}}/src/plugin.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ const examplePlugin: IPlugin<Application<Widget>, void> = {
2929
requires: [IJupyterWidgetRegistry],
3030
activate: activateWidgetExtension,
3131
autoStart: true
32-
};
32+
} as unknown as IPlugin<Application<Widget>, void>;
33+
// the "as unknown as ..." typecast above is solely to support JupyterLab 1
34+
// and 2 in the same codebase and should be removed when we migrate to Lumino.
3335

3436
export default examplePlugin;
3537

{{cookiecutter.github_project_name}}/tests/karma.conf.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ module.exports = function (config) {
3535
"directory": "coverage",
3636
"filename": "coverage.lcov"
3737
}
38+
},
39+
bundlerOptions: {
40+
transforms: [
41+
require("karma-typescript-es6-transform")()
42+
]
3843
}
3944
}
4045
});

{{cookiecutter.github_project_name}}/tests/src/utils.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class MockComm {
2121
on_msg(fn: Function | null) {
2222
this._on_msg = fn;
2323
}
24-
_process_msg(msg: services.KernelMessage.ICommMsg) {
24+
_process_msg(msg: services.KernelMessage.ICommMsgMsg) {
2525
if (this._on_msg) {
2626
return this._on_msg(msg);
2727
} else {

0 commit comments

Comments
 (0)