From 9afa6a97cf300001b6523a2fd179b79cc3ac8746 Mon Sep 17 00:00:00 2001 From: "Maarten A. Breddels" Date: Tue, 11 Jul 2023 17:44:55 +0200 Subject: [PATCH 1/4] fix: add set_custom_exc to support a recent dask In https://github.com/dask/dask/pull/10354 dask calls set_custom_exc to set a custom exception handler. This breaks solara with dask because we have a custom/fake IPython implementation. Fixes https://github.com/widgetti/solara/issues/191 --- solara/server/patch.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/solara/server/patch.py b/solara/server/patch.py index cc92fd5e7..3b1f361a3 100644 --- a/solara/server/patch.py +++ b/solara/server/patch.py @@ -69,6 +69,10 @@ def magic(self, *args): # proplot requires this pass + def set_custom_exc(self, exc_tuple, handler): + # make dask work + pass + def kernel_instance_dispatch(cls, *args, **kwargs): context = app.get_current_context() From 1c75b62f06bcff92dca60b799f0fd39bd3b7e2bc Mon Sep 17 00:00:00 2001 From: "Maarten A. Breddels" Date: Tue, 11 Jul 2023 18:19:23 +0200 Subject: [PATCH 2/4] =?UTF-8?q?Bump=20version:=201.17.5=20=E2=86=92=201.18?= =?UTF-8?q?.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .bumpversion.cfg | 2 +- packages/assets/solara_assets/__init__.py | 2 +- packages/solara-enterprise/pyproject.toml | 2 +- packages/solara-enterprise/solara_enterprise/__init__.py | 2 +- pyproject.toml | 2 +- release.md | 6 +++--- solara/__init__.py | 2 +- solara/server/static/solara_bootstrap.py | 2 +- 8 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 7304c935b..15d1dfbf7 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 1.17.5 +current_version = 1.18.0 commit = True tag = True parse = (?P\d+)(\.(?P\d+))(\.(?P\d+))((?P.)(?P\d+))? diff --git a/packages/assets/solara_assets/__init__.py b/packages/assets/solara_assets/__init__.py index 4374d79c7..a15d9fcda 100644 --- a/packages/assets/solara_assets/__init__.py +++ b/packages/assets/solara_assets/__init__.py @@ -1,2 +1,2 @@ "CDN assets for Solara" -__version__ = "1.17.5" +__version__ = "1.18.0" diff --git a/packages/solara-enterprise/pyproject.toml b/packages/solara-enterprise/pyproject.toml index 8381a3d2a..82efff6d9 100644 --- a/packages/solara-enterprise/pyproject.toml +++ b/packages/solara-enterprise/pyproject.toml @@ -11,7 +11,7 @@ license = {file = "LICENSE"} classifiers = ["License :: Free for non-commercial use"] dynamic = ["version", "description"] dependencies = [ - "solara==1.17.5", + "solara==1.18.0", ] [project.optional-dependencies] diff --git a/packages/solara-enterprise/solara_enterprise/__init__.py b/packages/solara-enterprise/solara_enterprise/__init__.py index 897d8bf01..3f2ac7bef 100644 --- a/packages/solara-enterprise/solara_enterprise/__init__.py +++ b/packages/solara-enterprise/solara_enterprise/__init__.py @@ -1,2 +1,2 @@ "Enterprise features for Solara" -__version__ = "1.17.5" +__version__ = "1.18.0" diff --git a/pyproject.toml b/pyproject.toml index 46bf83952..55b185df4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -81,7 +81,7 @@ dev = [ "pytest-playwright; python_version > '3.6'", ] assets = [ - "solara-assets==1.17.5" + "solara-assets==1.18.0" ] flask = [ "flask", diff --git a/release.md b/release.md index b36fd9955..3e377d386 100644 --- a/release.md +++ b/release.md @@ -7,14 +7,14 @@ ## Making an alpha release - $ ./release.sh patch --new-version 1.17.5a1 + $ ./release.sh patch --new-version 1.18.0a1 # semi automated To make a new release ``` # update solara/__init__.py -$ git add -u && git commit -m 'Release v1.17.5' && git tag v1.17.5 && git push upstream master v1.17.5 +$ git add -u && git commit -m 'Release v1.18.0' && git tag v1.18.0 && git push upstream master v1.18.0 ``` @@ -22,5 +22,5 @@ If a problem happens, and you want to keep the history clean ``` # do fix $ git rebase -i HEAD~3 -$ git tag v1.17.5 -f && git push upstream master v1.17.5 -f +$ git tag v1.18.0 -f && git push upstream master v1.18.0 -f ``` diff --git a/solara/__init__.py b/solara/__init__.py index f4b69fd62..37160027d 100644 --- a/solara/__init__.py +++ b/solara/__init__.py @@ -1,5 +1,5 @@ """Build webapps using IPywidgets""" -__version__ = "1.17.5" +__version__ = "1.18.0" github_url = "https://github.com/widgetti/solara" git_branch = "master" diff --git a/solara/server/static/solara_bootstrap.py b/solara/server/static/solara_bootstrap.py index c8c1a5f1e..2785dca52 100644 --- a/solara/server/static/solara_bootstrap.py +++ b/solara/server/static/solara_bootstrap.py @@ -119,7 +119,7 @@ async def main(): ] for dep in requirements: await micropip.install(dep, keep_going=True) - await micropip.install("/wheels/solara-1.17.5-py2.py3-none-any.whl", keep_going=True) + await micropip.install("/wheels/solara-1.18.0-py2.py3-none-any.whl", keep_going=True) import solara el = solara.Warning("lala") From c5a3067557addd491d46123f40d6942897f0457b Mon Sep 17 00:00:00 2001 From: "Maarten A. Breddels" Date: Tue, 18 Jul 2023 15:50:09 +0200 Subject: [PATCH 3/4] refactor: we need no special support for pyodide --- solara/server/static/main-vuetify.js | 40 +--------------------------- 1 file changed, 1 insertion(+), 39 deletions(-) diff --git a/solara/server/static/main-vuetify.js b/solara/server/static/main-vuetify.js index 40ee1607b..d9fab8d30 100644 --- a/solara/server/static/main-vuetify.js +++ b/solara/server/static/main-vuetify.js @@ -79,38 +79,6 @@ function injectDebugMessageInterceptor(kernel) { } -class WebSocketRedirectWebWorker { - // redirects to webworker - constructor(url) { - console.log('connect url intercepted', url) - function make_default(name) { - return () => { - console.log("default ", name) - } - } - this.onopen = make_default('onopen') - this.onclose = make_default('onclose') - this.onmessage = make_default('onmessage') - setTimeout(() => this.start(), 10) - } - send(msg) { - // console.log('WebSocketRedirectWebWorker: send msg', msg) - window.parent.postMessage({ 'type': 'send', 'value': msg }) - } - start() { - self.addEventListener('message', async (event) => { - let msg = event.data - // console.log('WebSocketRedirectWebWorker on msg', msg) - if (msg.type == 'send') { - this.onmessage({ data: msg.value }) - } - }); - this.onopen() - // solaraWorker.postMessage({ 'type': 'open' }) - } -} - - function getCookiesMap(cookiesString) { return cookiesString.split(";") .map(function (cookieString) { @@ -153,13 +121,7 @@ async function solaraInit(mountId, appName) { kernel.dispose() window.navigator.sendBeacon(close_url); }); - console.log("solara.browser_platform", solara.browser_platform); - if (solara.browser_platform) { - options = { WebSocket: WebSocketRedirectWebWorker } - } else { - options = {} - } - let kernel = await solara.connectKernel(solara.rootPath + '/jupyter', uuid, options) + let kernel = await solara.connectKernel(solara.rootPath + '/jupyter', uuid) if (!kernel) { return; } From 96c06f0e7b2caa52e36dd162ba9308519e22ce4b Mon Sep 17 00:00:00 2001 From: "Maarten A. Breddels" Date: Wed, 19 Jul 2023 08:10:06 +0200 Subject: [PATCH 4/4] fix: support normal kernel when not in solara context --- solara/server/patch.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/solara/server/patch.py b/solara/server/patch.py index 3b1f361a3..207c7fb75 100644 --- a/solara/server/patch.py +++ b/solara/server/patch.py @@ -74,9 +74,15 @@ def set_custom_exc(self, exc_tuple, handler): pass +kernel_instance_dispatch_initial = ipykernel.kernelbase.Kernel.instance.__func__ + + def kernel_instance_dispatch(cls, *args, **kwargs): - context = app.get_current_context() - return context.kernel + if not app.has_current_context(): + return kernel_instance_dispatch_initial(cls, *args, **kwargs) + else: + context = app.get_current_context() + return context.kernel InteractiveShell_instance_initial = InteractiveShell.instance