Skip to content

Commit 51e9fed

Browse files
authored
Merge pull request #42 from jasongrout/updates
More updates
2 parents dd4934d + 057a7b3 commit 51e9fed

File tree

20 files changed

+110
-86
lines changed

20 files changed

+110
-86
lines changed

README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ information:
3434
- `npm_package_name`: name for the npm "front-end" package holding the JavaScript
3535
implementation used in your custom widget.
3636
- `npm_package_version`: initial version of the npm package.
37-
- `jlab_extension_id`: extension ID to supply to JupyterLab when registering the extension.
38-
The recommended format is "jupyter.extensions.<Your UNIQUE designator here>".
3937
- `project_short_description` : a short description for your project that will
4038
be used for both the "back-end" and "front-end" packages.
4139

@@ -64,7 +62,7 @@ jupyter labextension install .
6462
For classic notebook, you can run:
6563

6664
```
67-
jupyter nbextension install --sys-prefix --symlink --py <your python package name>
65+
jupyter nbextension install --sys-prefix --symlink --overwrite --py <your python package name>
6866
jupyter nbextension enable --sys-prefix --py <your python package name>
6967
```
7068

cookiecutter.json

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
{
22
"author_name": "",
33
"author_email": "",
4-
"github_project_name": "jupyter-widget-example",
5-
"github_organization_name": "jupyter",
6-
"python_package_name": "ipywidgetexample",
7-
"npm_package_name": "jupyter-widget-example",
4+
"github_project_name": "",
5+
"github_organization_name": "",
6+
"python_package_name": "{{ cookiecutter.github_project_name }}",
7+
"npm_package_name": "{{ cookiecutter.github_project_name }}",
88
"npm_package_version": "0.1.0",
9-
"jlab_extension_id": "jupyter.extensions.example",
109
"project_short_description": "A Custom Jupyter Widget Library"
1110
}

tests/testconfig.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ default_context:
44
github_project_name: "jupyter-widget-testwidgets"
55
github_organization_name: "jupyter"
66
python_package_name: "ipywidgettestwidgets"
7-
npm_package_name: "jupyter-widget-testwidgets"
7+
npm_package_name: "@jupyter-widgets/jupyter-widget-testwidgets"
88
npm_package_version: "1.1.0"
9-
jlab_extension_id: "jupyter.extensions.testwidgets"
109
project_short_description: "A Test Jupyter Widget Library"

{{cookiecutter.github_project_name}}/LICENSE.txt

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,19 @@
1-
BSD 3-Clause License
2-
3-
Copyright (c) {% now 'local', '%Y' %}, {{ cookiecutter.author_name }}
1+
Copyright (c) {% now 'local', '%Y' %} {{ cookiecutter.author_name }}
42
All rights reserved.
53

64
Redistribution and use in source and binary forms, with or without
75
modification, are permitted provided that the following conditions are met:
86

9-
* Redistributions of source code must retain the above copyright notice, this
10-
list of conditions and the following disclaimer.
7+
1. Redistributions of source code must retain the above copyright notice, this
8+
list of conditions and the following disclaimer.
119

12-
* Redistributions in binary form must reproduce the above copyright notice,
13-
this list of conditions and the following disclaimer in the documentation
14-
and/or other materials provided with the distribution.
10+
2. Redistributions in binary form must reproduce the above copyright notice,
11+
this list of conditions and the following disclaimer in the documentation
12+
and/or other materials provided with the distribution.
1513

16-
* Neither the name of the copyright holder nor the names of its
17-
contributors may be used to endorse or promote products derived from
18-
this software without specific prior written permission.
14+
3. Neither the name of the copyright holder nor the names of its
15+
contributors may be used to endorse or promote products derived from
16+
this software without specific prior written permission.
1917

2018
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
2119
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE

{{cookiecutter.github_project_name}}/README.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,21 @@
99

1010
## Installation
1111

12-
A typical installation requires the following commands to be run:
12+
You can install using `pip`:
1313

1414
```bash
1515
pip install {{ cookiecutter.python_package_name }}
16-
jupyter nbextension enable --py [--sys-prefix|--user|--system] {{ cookiecutter.python_package_name }}
1716
```
1817

19-
Or, if you use jupyterlab:
18+
Or if you use jupyterlab:
2019

2120
```bash
2221
pip install {{ cookiecutter.python_package_name }}
2322
jupyter labextension install @jupyter-widgets/jupyterlab-manager
2423
```
24+
25+
If you are using Jupyter Notebook 5.2 or earlier, you may also need to enable
26+
the nbextension:
27+
```bash
28+
jupyter nbextension enable --py [--sys-prefix|--user|--system] {{ cookiecutter.python_package_name }}
29+
```

{{cookiecutter.github_project_name}}/package.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@
1717
"url": "https://github.com/{{ cookiecutter.github_organization_name }}/{{ cookiecutter.github_project_name }}/issues"
1818
},
1919
"license": "BSD-3-Clause",
20-
"author": "",
20+
"author": {
21+
"name": "{{ cookiecutter.author_name }}",
22+
"email": "{{ cookiecutter.author_email }}"
23+
},
2124
"main": "lib/index.js",
2225
"types": "./lib/index.d.ts",
2326
"repository": {
@@ -27,7 +30,7 @@
2730
"scripts": {
2831
"build": "npm run build:lib && npm run build:nbextension",
2932
"build:labextension": "npm run clean:labextension && mkdirp {{ cookiecutter.python_package_name }}/labextension && cd {{ cookiecutter.python_package_name }}/labextension && npm pack ../..",
30-
"build:lib": "tsc --project src",
33+
"build:lib": "tsc",
3134
"build:nbextension": "webpack -p",
3235
"build:all": "npm run build:labextension && npm run build:nbextension",
3336
"clean": "npm run clean:lib && npm run clean:nbextension",
@@ -41,7 +44,7 @@
4144
"test:firefox": "karma start --browsers=Firefox tests/karma.conf.js",
4245
"test:ie": "karma start --browsers=IE tests/karma.conf.js",
4346
"watch": "npm-run-all -p watch:*",
44-
"watch:lib": "tsc -w --project src",
47+
"watch:lib": "tsc -w",
4548
"watch:nbextension": "webpack --watch"
4649
},
4750
"dependencies": {

{{cookiecutter.github_project_name}}/setup.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@
4444
}
4545

4646
data_files_spec = [
47-
('share/jupyter/nbextensions/{{ cookiecutter.npm_package_name }}',
47+
('share/jupyter/nbextensions/{{ cookiecutter.python_package_name}}',
4848
nb_path, '*.js*'),
4949
('share/jupyter/lab/extensions', lab_path, '*.tgz'),
50-
('etc/jupyter/nbconfig/notebook.d' , HERE, '{{ cookiecutter.npm_package_name }}.json')
50+
('etc/jupyter/nbconfig/notebook.d' , HERE, '{{ cookiecutter.python_package_name}}.json')
5151
]
5252

5353

@@ -101,7 +101,7 @@
101101
'sphinx>=1.5',
102102
'recommonmark',
103103
'sphinx_rtd_theme',
104-
'nbsphinx>=0.2.13',
104+
'nbsphinx>=0.2.13,<0.4.0',
105105
'jupyter_sphinx',
106106
'nbsphinx-link',
107107
'pytest_check_links',

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@
88
// Some static assets may be required by the custom widget javascript. The base
99
// url for the notebook is not known at build time and is therefore computed
1010
// dynamically.
11-
__webpack_public_path__ = document.querySelector('body')!.getAttribute('data-base-url') + 'nbextensions/{{ cookiecutter.npm_package_name }}';
11+
(window as any).__webpack_public_path__ = document.querySelector('body')!.getAttribute('data-base-url') + 'nbextensions/{{ cookiecutter.npm_package_name }}';
1212

1313
export * from './index';
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1+
// Copyright (c) {{ cookiecutter.author_name }}
2+
// Distributed under the terms of the Modified BSD License.
13

2-
export * from './plugin';
34
export * from './version';
45
export * from './widget';

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) Jupyter Development Team.
1+
// Copyright (c) {{ cookiecutter.author_name }}
22
// Distributed under the terms of the Modified BSD License.
33

44
import {
@@ -19,8 +19,7 @@ import {
1919
MODULE_NAME, MODULE_VERSION
2020
} from './version';
2121

22-
const EXTENSION_ID = '{{ cookiecutter.jlab_extension_id }}';
23-
22+
const EXTENSION_ID = '{{ cookiecutter.npm_package_name }}:plugin';
2423

2524
/**
2625
* The example plugin.

0 commit comments

Comments
 (0)