Skip to content

Commit fbe019f

Browse files
committed
fix issues with jupyter server extension
1 parent a47810e commit fbe019f

File tree

6 files changed

+55
-165
lines changed

6 files changed

+55
-165
lines changed

MANIFEST.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
graft reactpy_jupyter/static
2+
graft jupyter-config
23

34
include LICENSE
45
include pyproject.toml
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"ServerApp": {
3+
"jpserver_extensions": {
4+
"reactpy_jupyter.jupyter_server_extension": true
5+
}
6+
}
7+
}

notebooks/introduction.ipynb

Lines changed: 21 additions & 154 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
},
3535
{
3636
"cell_type": "code",
37-
"execution_count": 1,
37+
"execution_count": null,
3838
"metadata": {
3939
"tags": []
4040
},
@@ -54,36 +54,11 @@
5454
},
5555
{
5656
"cell_type": "code",
57-
"execution_count": 2,
57+
"execution_count": null,
5858
"metadata": {
5959
"tags": []
6060
},
61-
"outputs": [
62-
{
63-
"data": {
64-
"text/plain": [
65-
"App(7f831e1eb8e0)"
66-
]
67-
},
68-
"execution_count": 2,
69-
"metadata": {},
70-
"output_type": "execute_result"
71-
},
72-
{
73-
"data": {
74-
"application/vnd.jupyter.widget-view+json": {
75-
"model_id": "8ca2de7c99cd4632a75a4b7e2ccd8c62",
76-
"version_major": 2,
77-
"version_minor": 0
78-
},
79-
"text/plain": [
80-
"LayoutWidget(Layout(App(7f831e1eb8e0)))"
81-
]
82-
},
83-
"metadata": {},
84-
"output_type": "display_data"
85-
}
86-
],
61+
"outputs": [],
8762
"source": [
8863
"from reactpy import component, html, run\n",
8964
"\n",
@@ -109,36 +84,11 @@
10984
},
11085
{
11186
"cell_type": "code",
112-
"execution_count": 3,
87+
"execution_count": null,
11388
"metadata": {
11489
"tags": []
11590
},
116-
"outputs": [
117-
{
118-
"data": {
119-
"text/plain": [
120-
"TodoList(7f82f69b9d20)"
121-
]
122-
},
123-
"execution_count": 3,
124-
"metadata": {},
125-
"output_type": "execute_result"
126-
},
127-
{
128-
"data": {
129-
"application/vnd.jupyter.widget-view+json": {
130-
"model_id": "48c10976713b4660aec8006cfb56d6ed",
131-
"version_major": 2,
132-
"version_minor": 0
133-
},
134-
"text/plain": [
135-
"LayoutWidget(Layout(TodoList(7f82f69b9d20)))"
136-
]
137-
},
138-
"metadata": {},
139-
"output_type": "display_data"
140-
}
141-
],
91+
"outputs": [],
14292
"source": [
14393
"from reactpy import component, html\n",
14494
"\n",
@@ -187,36 +137,11 @@
187137
},
188138
{
189139
"cell_type": "code",
190-
"execution_count": 4,
140+
"execution_count": null,
191141
"metadata": {
192142
"tags": []
193143
},
194-
"outputs": [
195-
{
196-
"data": {
197-
"text/plain": [
198-
"Gallery(7f82f69ba560)"
199-
]
200-
},
201-
"execution_count": 4,
202-
"metadata": {},
203-
"output_type": "execute_result"
204-
},
205-
{
206-
"data": {
207-
"application/vnd.jupyter.widget-view+json": {
208-
"model_id": "b4384c2e668a4d66a14d8baf39582c38",
209-
"version_major": 2,
210-
"version_minor": 0
211-
},
212-
"text/plain": [
213-
"LayoutWidget(Layout(Gallery(7f82f69ba560)))"
214-
]
215-
},
216-
"metadata": {},
217-
"output_type": "display_data"
218-
}
219-
],
144+
"outputs": [],
220145
"source": [
221146
"import json\n",
222147
"from pathlib import Path\n",
@@ -266,7 +191,7 @@
266191
},
267192
{
268193
"cell_type": "code",
269-
"execution_count": 5,
194+
"execution_count": null,
270195
"metadata": {
271196
"tags": []
272197
},
@@ -302,27 +227,11 @@
302227
},
303228
{
304229
"cell_type": "code",
305-
"execution_count": 6,
230+
"execution_count": null,
306231
"metadata": {
307232
"tags": []
308233
},
309-
"outputs": [
310-
{
311-
"data": {
312-
"application/vnd.jupyter.widget-view+json": {
313-
"model_id": "2a6caf5369804e35ad588055e5531475",
314-
"version_major": 2,
315-
"version_minor": 0
316-
},
317-
"text/plain": [
318-
"Box(children=(IntSlider(value=0, readout=False), LayoutWidget(Layout(SliderObserver(7f82f69bb1c0, slider=IntSl…"
319-
]
320-
},
321-
"execution_count": 6,
322-
"metadata": {},
323-
"output_type": "execute_result"
324-
}
325-
],
234+
"outputs": [],
326235
"source": [
327236
"from ipywidgets import Box, IntSlider\n",
328237
"from reactpy_jupyter import LayoutWidget\n",
@@ -342,27 +251,11 @@
342251
},
343252
{
344253
"cell_type": "code",
345-
"execution_count": 7,
254+
"execution_count": null,
346255
"metadata": {
347256
"tags": []
348257
},
349-
"outputs": [
350-
{
351-
"data": {
352-
"application/vnd.jupyter.widget-view+json": {
353-
"model_id": "a10ce98ff2594a97b44ace36c69eff8b",
354-
"version_major": 2,
355-
"version_minor": 0
356-
},
357-
"text/plain": [
358-
"Box(children=(IntSlider(value=0, readout=False), LayoutWidget(Layout(SliderObserver(7f82f69bb7c0, slider=IntSl…"
359-
]
360-
},
361-
"execution_count": 7,
362-
"metadata": {},
363-
"output_type": "execute_result"
364-
}
365-
],
258+
"outputs": [],
366259
"source": [
367260
"from reactpy_jupyter import widgetize\n",
368261
"\n",
@@ -394,44 +287,11 @@
394287
},
395288
{
396289
"cell_type": "code",
397-
"execution_count": 8,
290+
"execution_count": null,
398291
"metadata": {
399292
"tags": []
400293
},
401-
"outputs": [
402-
{
403-
"name": "stderr",
404-
"output_type": "stream",
405-
"text": [
406-
"/tmp/ipykernel_285455/2504933715.py:4: DeprecationWarning: module_from_template() is deprecated due to instability - use the Javascript Components API instead. This function will be removed in a future release.\n",
407-
" victory = web.module_from_template(\"react\", \"victory-bar\", fallback=\"\")\n"
408-
]
409-
},
410-
{
411-
"data": {
412-
"text/plain": [
413-
"Demo(7f82f69baf20)"
414-
]
415-
},
416-
"execution_count": 8,
417-
"metadata": {},
418-
"output_type": "execute_result"
419-
},
420-
{
421-
"data": {
422-
"application/vnd.jupyter.widget-view+json": {
423-
"model_id": "cc89dd4bd4a84ef38f87f32094b94229",
424-
"version_major": 2,
425-
"version_minor": 0
426-
},
427-
"text/plain": [
428-
"LayoutWidget(Layout(Demo(7f82f69baf20)))"
429-
]
430-
},
431-
"metadata": {},
432-
"output_type": "display_data"
433-
}
434-
],
294+
"outputs": [],
435295
"source": [
436296
"from reactpy import component, web\n",
437297
"\n",
@@ -455,6 +315,13 @@
455315
"source": [
456316
"# [Learn More!](https://reactpy-docs.herokuapp.com)"
457317
]
318+
},
319+
{
320+
"cell_type": "code",
321+
"execution_count": null,
322+
"metadata": {},
323+
"outputs": [],
324+
"source": []
458325
}
459326
],
460327
"metadata": {

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[build-system]
2-
requires = ["setuptools>=42", "wheel"]
2+
requires = ["jupyter_packaging~=0.12.3", "setuptools>=42", "wheel"]
33
build-backend = "setuptools.build_meta"

setup.py

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
from setuptools import find_packages, setup
1212
from setuptools.command.develop import develop
1313
from setuptools.command.sdist import sdist
14+
from jupyter_packaging import get_data_files
1415

1516

1617
if sys.platform == "win32":
@@ -100,14 +101,14 @@ def list2cmdline(cmd_list):
100101
# --------------------------------------------------------------------------------------
101102

102103
package["install_requires"] = [
103-
"anywidget<1",
104-
"reactpy>=1.0.0",
105-
"appdirs",
106-
"requests",
107-
"jupyter_server",
108-
"notebook",
109-
"typing_extensions",
110-
]
104+
"anywidget<1",
105+
"reactpy>=1.0.0",
106+
"appdirs",
107+
"requests",
108+
"jupyter_server",
109+
"notebook",
110+
"typing_extensions",
111+
]
111112

112113
# --------------------------------------------------------------------------------------
113114
# Library Description
@@ -122,10 +123,18 @@ def list2cmdline(cmd_list):
122123

123124

124125
# --------------------------------------------------------------------------------------
125-
# Command Line Interface
126+
# Jupyter Config Data Files
126127
# --------------------------------------------------------------------------------------
127128

128-
package["entry_points"] = {"console_scripts": ["reactpy=reactpy.__main__:app"]}
129+
package["data_files"] = get_data_files(
130+
[
131+
(
132+
"etc/jupyter",
133+
"jupyter-config",
134+
"**",
135+
),
136+
]
137+
)
129138

130139
# --------------------------------------------------------------------------------------
131140
# Build Javascript

src/index.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ export function render(view) {
1010
let viewID = 0;
1111

1212
class JupyterReactPyClient extends BaseReactPyClient {
13+
/**
14+
* @param view {DOMWidgetView}
15+
* @param viewID {number}
16+
*/
1317
constructor(view, viewId) {
1418
super();
1519
this.view = view;
@@ -52,6 +56,7 @@ class JupyterReactPyClient extends BaseReactPyClient {
5256
});
5357
}
5458

59+
/** @param message {any} */
5560
sendMessage(message) {
5661
this.view.model.send({
5762
type: "dom-event",
@@ -60,6 +65,7 @@ class JupyterReactPyClient extends BaseReactPyClient {
6065
});
6166
}
6267

68+
/** @param moduleName {string} */
6369
loadModule(moduleName) {
6470
return import(`${this.importSourceBaseUrl}/${moduleName}`);
6571
}

0 commit comments

Comments
 (0)