Skip to content

Commit 6fca3e5

Browse files
committed
upgrade idom
1 parent 0b0dfad commit 6fca3e5

File tree

6 files changed

+55
-47
lines changed

6 files changed

+55
-47
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ idom_jupyter/labextension/
1212
.DS_Store
1313

1414
# Py Env
15+
venv
1516
.python-version
1617

1718
# VSCode

MANIFEST

Lines changed: 0 additions & 37 deletions
This file was deleted.

idom_jupyter/ipython_extension.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from functools import partial
22

3+
from idom.config import IDOM_CLIENT_IMPORT_SOURCE_URL
34
from idom.core.component import AbstractComponent
45
from IPython import get_ipython
56
from IPython.display import display
@@ -14,6 +15,9 @@
1415
def load_ipython_extension(ipython):
1516
global _POST_RUN_CELL_HOOK, _EXTENSION_LOADED
1617
if not _EXTENSION_LOADED:
18+
# allow client to determine build location
19+
IDOM_CLIENT_IMPORT_SOURCE_URL.set("./")
20+
1721
_POST_RUN_CELL_HOOK = partial(_post_run_cell, ipython)
1822
ipython.events.register("post_run_cell", _POST_RUN_CELL_HOOK)
1923
ipython.display_formatter.ipython_display_formatter.for_type(

idom_jupyter/jupyter_server_extension.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
11
from urllib.parse import urljoin
22

33
from notebook.notebookapp import NotebookApp
4-
from idom.client.manage import WEB_MODULES_DIR
4+
from idom.config import IDOM_CLIENT_BUILD_DIR
55
from tornado.web import StaticFileHandler
66
from tornado.web import Application
77

88

99
def _load_jupyter_server_extension(notebook_app: NotebookApp):
1010
web_app: Application = notebook_app.web_app
11-
route_pattern = urljoin(web_app.settings["base_url"], "_idom_web_modules/(.*)")
11+
base_url = web_app.settings["base_url"]
12+
route_pattern = urljoin(base_url, r"_idom_web_modules/(.*)")
1213
web_app.add_handlers(
1314
host_pattern=".*$",
1415
host_handlers=[
1516
(
1617
route_pattern,
1718
StaticFileHandler,
18-
{"path": str(WEB_MODULES_DIR.absolute())},
19+
{"path": str(IDOM_CLIENT_BUILD_DIR.get().absolute())},
1920
),
2021
],
2122
)

notebooks/introduction.ipynb

Lines changed: 45 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,24 @@
3131
},
3232
{
3333
"cell_type": "code",
34-
"execution_count": null,
34+
"execution_count": 1,
3535
"metadata": {},
36-
"outputs": [],
36+
"outputs": [
37+
{
38+
"data": {
39+
"application/vnd.jupyter.widget-view+json": {
40+
"model_id": "54ca25e9c74e4790aea3020c3bf47cff",
41+
"version_major": 2,
42+
"version_minor": 0
43+
},
44+
"text/plain": [
45+
"LayoutWidget()"
46+
]
47+
},
48+
"metadata": {},
49+
"output_type": "display_data"
50+
}
51+
],
3752
"source": [
3853
"import idom\n",
3954
"import idom_jupyter\n",
@@ -63,18 +78,42 @@
6378
},
6479
{
6580
"cell_type": "code",
66-
"execution_count": null,
81+
"execution_count": 2,
6782
"metadata": {},
68-
"outputs": [],
83+
"outputs": [
84+
{
85+
"name": "stdout",
86+
"output_type": "stream",
87+
"text": [
88+
"2021-03-30T16:24:30-0700 | INFO | Already installed ['victory']\r\n",
89+
"2021-03-30T16:24:30-0700 | INFO | Build skipped ✅\r\n"
90+
]
91+
}
92+
],
6993
"source": [
7094
"!idom install victory"
7195
]
7296
},
7397
{
7498
"cell_type": "code",
75-
"execution_count": null,
99+
"execution_count": 3,
76100
"metadata": {},
77-
"outputs": [],
101+
"outputs": [
102+
{
103+
"data": {
104+
"application/vnd.jupyter.widget-view+json": {
105+
"model_id": "33e61a1f3f7949c1a5c15a0d3c3e485a",
106+
"version_major": 2,
107+
"version_minor": 0
108+
},
109+
"text/plain": [
110+
"LayoutWidget()"
111+
]
112+
},
113+
"metadata": {},
114+
"output_type": "display_data"
115+
}
116+
],
78117
"source": [
79118
"victory = idom.Module(\"victory\", fallback=\"loading...\")\n",
80119
"\n",

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
description="A client for IDOM implemented using Jupyter widgets",
6868
long_description=LONG_DESCRIPTION,
6969
include_package_data=True,
70-
install_requires=["ipywidgets>=7.6.0", "idom>=0.22.2"],
70+
install_requires=["ipywidgets>=7.6.0", "idom>=0.23,<0.24"],
7171
packages=find_packages(),
7272
zip_safe=False,
7373
cmdclass=cmdclass,

0 commit comments

Comments
 (0)