Skip to content

Commit fc6844f

Browse files
committed
Merge pull request #264 from jdfreder/shim-services
Create basic comm API shim for jupyter-js-services
2 parents a5e6081 + d3bf9f1 commit fc6844f

25 files changed

+761
-83
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,4 @@ __pycache__
2323
.xunit.xml
2424

2525
index.built.js
26+
**/es5/

examples/development/node/README.md

+10-9
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
1-
# Using ipywidgets in node
1+
# Using jupyter-js-widgets in node
22
## Description
33
This directory is an example project that shows how you can use the widgets in
4-
node using `jsdom` and `navigator`. It prints a list of all `ipywidget`
4+
node using `jsdom` and `navigator`. It prints a list of all `jupyter-js-widgets`
55
exported names to the command line.
66

77
## Try it
8-
1. Open a command line in this directory and run `npm install`.
9-
2. In the same command line, run `node index.js`.
8+
1. Open a command line in the `ipywidgets/ipywidgets` subdirectory and run `npm install`.
9+
2. Cd into this directory and run `npm install`.
10+
3. Now open the `index.html` file.
1011

1112
## Details
1213
If you plan to reproduce this in your own project, pay careful attention to the
13-
package.json file. The dependency to ipywidgets, which reads
14-
`"ipywidgets": "file:../../.."`, **should not** point to `"file:../../.."`.
15-
Instead point it to the version you want to use on npm.
14+
package.json file. The dependency to jupyter-js-widgets, which reads
15+
`"jupyter-js-widgets": "file:../../../ipywidgets"`, **should not** point to `"file:../../../ipywidgets"`.
16+
Instead point it to the version you want to use on npm.
1617

17-
(but really, you should let npm do this for you by running
18-
`npm install --save ipywidgets`.)
18+
(but really, you should let npm do this for you by running
19+
`npm install --save jupyter-js-widgets`.)

examples/development/node/index.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ jsdom.env('<html><head/><body/></html>', function (err, window) {
66
global.window = window;
77
global.document = window.document;
88
global.navigator = require('navigator');
9-
9+
1010
// DEMO
11-
// Log the keys of ipywidgets.
12-
var ipywidgets = require('ipywidgets');
13-
console.log(Object.keys(ipywidgets));
11+
// Log the keys of jupyter-js-widgets.
12+
var jpywidgets = require('jupyter-js-widgets');
13+
console.log(Object.keys(jpywidgets));
1414

1515
// Clean-up DOM
1616
window.close();

examples/development/node/package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
{
2-
"name": "ipywidgets-test",
2+
"name": "jupyter-js-widgets-test",
33
"version": "1.0.0",
4-
"description": "Project that tests the ability to npm install ipywidgets within an npm project.",
4+
"description": "Project that tests the ability to npm install jupyter-js-widgets within an npm project.",
55
"main": "index.js",
66
"scripts": {
77
"test": "echo \"Error: no test specified\" && exit 1"
88
},
99
"author": "IPython",
1010
"license": "BSD-3-Clause",
1111
"dependencies": {
12-
"ipywidgets": "file:../../..",
12+
"jupyter-js-widgets": "file:../../../ipywidgets",
1313
"jsdom": "^7.0.1",
1414
"navigator": "^1.0.1"
1515
}

examples/development/web/README.md

+9-8
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
1-
# Using ipywidgets in non-notebook, web context
1+
# Using jupyter-js-widgets in non-notebook, web context
22
## Description
33
This directory is an example project that shows how you can embed the widgets in
44
a context other than the notebook.
55

66
## Try it
7-
1. Open a command line in this directory and run `npm install`.
8-
2. Now open the `index.html` file.
7+
1. Open a command line in the `ipywidgets/ipywidgets` subdirectory and run `npm install`.
8+
2. Cd into this directory and run `npm install`.
9+
3. Now open the `index.html` file.
910

1011
## Details
1112
If you plan to reproduce this in your own project, pay careful attention to the
12-
package.json file. The dependency to ipywidgets, which reads
13-
`"ipywidgets": "file:../../.."`, **should not** point to `"file:../../.."`.
14-
Instead point it to the version you want to use on npm.
13+
package.json file. The dependency to jupyter-js-widgets, which reads
14+
`"jupyter-js-widgets": "file:../../../ipywidgets"`, **should not** point to `"file:../../../ipywidgets"`.
15+
Instead point it to the version you want to use on npm.
1516

16-
(but really, you should let npm do this for you by running
17-
`npm install --save ipywidgets`.)
17+
(but really, you should let npm do this for you by running
18+
`npm install --save jupyter-js-widgets`.)

examples/development/web/manager.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
var ipywidgets = require('ipywidgets');
2-
console.info('ipywidgets loaded successfully');
1+
var jpywidgets = require('jupyter-js-widgets');
2+
console.info('jupyter-js-widgets loaded successfully');
33

44
var WidgetManager = exports.WidgetManager = function(el) {
55
// Call the base class.
6-
ipywidgets.ManagerBase.call(this);
6+
jpywidgets.ManagerBase.call(this);
77
this.el = el;
88

99
// Create a style tag that will be used to apply stateful styling to the
@@ -12,7 +12,7 @@ var WidgetManager = exports.WidgetManager = function(el) {
1212
this.styleTag.type = 'text/css';
1313
document.querySelectorAll('body')[0].appendChild(this.styleTag);
1414
};
15-
WidgetManager.prototype = Object.create(ipywidgets.ManagerBase.prototype);
15+
WidgetManager.prototype = Object.create(jpywidgets.ManagerBase.prototype);
1616

1717
WidgetManager.prototype.display_view = function(msg, view, options) {
1818
var that = this;

examples/development/web/package.json

+7-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
2-
"name": "ipywidgets-test",
2+
"name": "jupyter-js-widgets-test",
33
"version": "1.0.0",
4-
"description": "Project that tests the ability to npm install ipywidgets within an npm project.",
4+
"description": "Project that tests the ability to npm install jupyter-js-widgets within an npm project.",
55
"main": "index.js",
66
"scripts": {
77
"prepublish": "browserify -g node-lessify index.js --outfile index.built.js --debug",
@@ -11,7 +11,10 @@
1111
"license": "BSD-3-Clause",
1212
"dependencies": {
1313
"browserify": "^11.2.0",
14-
"node-lessify": "^0.1.1",
15-
"ipywidgets": "file:../../.."
14+
"jupyter-js-widgets": "file:../../../ipywidgets",
15+
"node-lessify": "^0.1.1"
16+
},
17+
"devDependencies": {
18+
"bower": "^1.7.0"
1619
}
1720
}

examples/development/web2/README.md

+9-8
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
1-
# Using ipywidgets in non-notebook, web context
1+
# Using jupyter-js-widgets in non-notebook, web context
22
## Description
33
This directory is an example project that shows how you can embed the widgets in
44
a context other than the notebook.
55

66
## Try it
7-
1. Open a command line in this directory and run `npm install`.
8-
2. Now open the `index.html` file.
7+
1. Open a command line in the `ipywidgets/ipywidgets` subdirectory and run `npm install`.
8+
2. Cd into this directory and run `npm install`.
9+
3. Now open the `index.html` file.
910

1011
## Details
1112
If you plan to reproduce this in your own project, pay careful attention to the
12-
package.json file. The dependency to ipywidgets, which reads
13-
`"ipywidgets": "file:../../.."`, **should not** point to `"file:../../.."`.
14-
Instead point it to the version you want to use on npm.
13+
package.json file. The dependency to jupyter-js-widgets, which reads
14+
`"jupyter-js-widgets": "file:../../../ipywidgets"`, **should not** point to `"file:../../../ipywidgets"`.
15+
Instead point it to the version you want to use on npm.
1516

16-
(but really, you should let npm do this for you by running
17-
`npm install --save ipywidgets`.)
17+
(but really, you should let npm do this for you by running
18+
`npm install --save jupyter-js-widgets`.)

examples/development/web2/index.html

+6-5
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,16 @@
22
<head>
33
<script src="index.built.js"></script>
44
<meta http-equiv="content-type" content="text/html; charset=UTF8">
5+
<link rel="stylesheet" type="text/css" href="./node_modules/font-awesome/css/font-awesome.css">
56
<style>
67
body {
78
margin-left: auto;
89
margin-right: auto;
9-
max-width: 900px;
10+
max-width: 900px;
1011
background-color: #eee;
11-
}
12-
13-
.ipywidgets-example {
12+
}
13+
14+
.jupyter-js-widgets-example {
1415
margin-top: 10px;
1516
margin-bottom: 10px;
1617
background-color: white;
@@ -35,7 +36,7 @@
3536
</style>
3637
</head>
3738
<body>
38-
<div class="ipywidgets-example">
39+
<div class="jupyter-js-widgets-example">
3940
<div class="inputarea"></div>
4041
<div class="widgetarea"></div>
4142
</div>

examples/development/web2/manager.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
require('./node_modules/ipywidgets/ipywidgets/static/components/bootstrap/css/bootstrap.css')
2-
require('./node_modules/ipywidgets/node_modules/jquery-ui/themes/smoothness/jquery-ui.min.css')
1+
require('./node_modules/jupyter-js-widgets/static/components/bootstrap/css/bootstrap.css')
2+
require('./node_modules/jquery-ui/themes/smoothness/jquery-ui.min.css')
33

4-
var ipywidgets = require('ipywidgets');
5-
console.info('ipywidgets loaded successfully');
4+
var jpywidgets = require('jupyter-js-widgets');
5+
console.info('jupyter-js-widgets loaded successfully');
66

77
var WidgetManager = exports.WidgetManager = function(el) {
88
// Call the base class.
9-
ipywidgets.ManagerBase.call(this);
9+
jpywidgets.ManagerBase.call(this);
1010
this.el = el;
1111
};
12-
WidgetManager.prototype = Object.create(ipywidgets.ManagerBase.prototype);
12+
WidgetManager.prototype = Object.create(jpywidgets.ManagerBase.prototype);
1313

1414
WidgetManager.prototype.display_view = function(msg, view, options) {
1515
var that = this;
+10-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
2-
"name": "ipywidgets-test",
2+
"name": "jupyter-js-widgets-test",
33
"version": "1.0.0",
4-
"description": "Project that tests the ability to npm install ipywidgets within an npm project.",
4+
"description": "Project that tests the ability to npm install jupyter-js-widgets within an npm project.",
55
"main": "index.js",
66
"scripts": {
77
"prepublish": "browserify -g node-lessify index.js --outfile index.built.js --debug",
@@ -11,8 +11,14 @@
1111
"license": "BSD-3-Clause",
1212
"dependencies": {
1313
"browserify": "^11.2.0",
14-
"node-lessify": "^0.1.1",
1514
"codemirror": "^5.9.0",
16-
"ipywidgets": "file:../../.."
15+
"font-awesome": "^4.5.0",
16+
"jupyter-js-widgets": "file:../../../ipywidgets",
17+
"jquery": "^2.1.4",
18+
"jquery-ui": "^1.10.5",
19+
"node-lessify": "^0.1.1"
20+
},
21+
"devDependencies": {
22+
"bower": "^1.7.0"
1723
}
1824
}
+3-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
[
2-
"from ipywidgets import VBox, jsdlink, IntSlider",
2+
"from ipywidgets import VBox, jsdlink, IntSlider, Button",
33
"",
44
"s1, s2 = IntSlider(max=200, value=100), IntSlider(value=40)",
5+
"b = Button(icon='fa-legal')",
56
"jsdlink((s1, 'value'), (s2, 'max'))",
6-
"VBox([s1, s2])"
7+
"VBox([s1, s2, b])"
78
]

0 commit comments

Comments
 (0)