From d7506cca4a0fc20cdb2c22c4db2ce7a938564a3b Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Wed, 15 Jan 2025 00:10:05 +0530 Subject: [PATCH 1/7] Use JupyterLite 0.5.0 + Pyodide kernel 0.5.0 --- requirements.txt | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/requirements.txt b/requirements.txt index 19b920f..5bf233b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,9 +1,11 @@ -# Core modules (mandatory) -jupyterlab~=4.2.5 -jupyterlite-core>=0.4.5,<0.5 - -# Python kernel (optional) -jupyterlite-pyodide-kernel>=0.4.7,<0.5 +# Core modules and Pyodide kernel (mandatory) +# Pyodide kernel versions 0.4.7 and 0.5.0 come with +# Pyodide 0.27, with SymPy 1.13.3, respectively: +# https://jupyterlite-pyodide-kernel.readthedocs.io/en/stable/#compatibility +# https://pyodide.org/en/stable/usage/packages-in-pyodide.html +# We constrain/pin them to avoid breaking changes on rebuilds. +jupyterlite-core>=0.5.0,<0.6.0 +jupyterlite-pyodide-kernel==0.5.0 # Specific to generating SymPy Live index page jinja2==3.1.5 From 53698cf543e8bd02ed7859f556c16866ca58ac1a Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Wed, 15 Jan 2025 00:10:41 +0530 Subject: [PATCH 2/7] Remove trailing whitespace --- templates/index.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/templates/index.html b/templates/index.html index 01fb28f..8a806d8 100644 --- a/templates/index.html +++ b/templates/index.html @@ -92,7 +92,7 @@
- {% trans %}Note it can take up to 30 seconds before the shell finishes loading and is ready to run commands.{% endtrans %} + {% trans %}Note it can take up to 30 seconds before the shell finishes loading and is ready to run commands.{% endtrans %}
@@ -120,7 +120,7 @@{% trans %}SymPy Live shell is powered by{% endtrans %} JupyterLite. - {% trans %}It can take up to 30 seconds before the shell code and libraries load completely and become available for using interactively.{% endtrans %} + {% trans %}It can take up to 30 seconds before the shell code and libraries load completely and become available for using interactively.{% endtrans %}
@@ -141,7 +141,7 @@- {% trans %}Read the tutorial in the SymPy docs to learn more about SymPy{% endtrans %}: + {% trans %}Read the tutorial in the SymPy docs to learn more about SymPy{% endtrans %}: {% trans %}SymPy Tutorial{% endtrans %}.
From ccd29251ee3df9c8f213cf603430b3dfb3641fa7 Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Wed, 15 Jan 2025 00:10:55 +0530 Subject: [PATCH 3/7] Point to stable documentation for JupyterLite --- templates/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/index.html b/templates/index.html index 8a806d8..cf52e92 100644 --- a/templates/index.html +++ b/templates/index.html @@ -119,7 +119,7 @@- {% trans %}SymPy Live shell is powered by{% endtrans %} JupyterLite. + {% trans %}SymPy Live shell is powered by{% endtrans %} JupyterLite. {% trans %}It can take up to 30 seconds before the shell code and libraries load completely and become available for using interactively.{% endtrans %}
From 05fdee5cad50118d7b7fd9de9d7c0c0e6860d621 Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Wed, 15 Jan 2025 00:12:02 +0530 Subject: [PATCH 4/7] Customise REPL URL --- templates/index.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/templates/index.html b/templates/index.html index cf52e92..59a13a7 100644 --- a/templates/index.html +++ b/templates/index.html @@ -45,7 +45,8 @@ $(document).ready(function() { // default iframe src with SymPy initcode - var iframe_src = "{{ host }}{{ path }}{{ query }}&code={{ initcode|urlencode }}"; + // see https://jupyterlite.readthedocs.io/en/stable/quickstart/embed-repl.html#configuration for URL customisation + var iframe_src = "{{ host }}{{ path }}{{ query }}?kernel=python&execute=0?toolbar=1&code={{ initcode|urlencode }}"; // check if we have additional statements to evaluate in the query string var statements = getURLParameter('evaluate'); if (statements) { From 442adce0ae184f82bcde8f0393296e8989090ca2 Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Wed, 15 Jan 2025 00:36:09 +0530 Subject: [PATCH 5/7] Disable source maps for a smaller build --- jupyter_lite_config.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/jupyter_lite_config.json b/jupyter_lite_config.json index bf97fc2..04affc9 100644 --- a/jupyter_lite_config.json +++ b/jupyter_lite_config.json @@ -1,6 +1,7 @@ { "LiteBuildConfig": { "apps": ["repl"], - "no_unused_shared_packages": true + "no_unused_shared_packages": true, + "no_sourcemaps": true } } From 26a8cca8e914c4b19d3f4cdefe3cea0f43a57bac Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Wed, 15 Jan 2025 10:32:14 +0530 Subject: [PATCH 6/7] Add `safe` Jinja filter, remove Python kernel and execute params Co-authored-by: Ivan Savov