From e0f237b9d701a39776b7b042aad3d73408e9be5e Mon Sep 17 00:00:00 2001 From: rstular Date: Thu, 7 Mar 2024 13:09:39 +0100 Subject: [PATCH 1/5] chore(deps): Update dependencies --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index a3dc6e5..d40dcd3 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,5 +6,5 @@ jupyterlite-sphinx --extra-index-url https://gitlab.tudelft.nl/api/v4/projects/11239/packages/pypi/simple sphinx-thebe == 0.2.1000 --extra-index-url https://gitlab.tudelft.nl/api/v4/projects/17983/packages/pypi/simple -jupyterbook_patches == 0.1.2 +jupyterbook_patches ~= 0.1.4 download_link_replacer @ git+https://gitlab.tudelft.nl/mude/sphinx-download-link-replacer@dlr-0.1.2 From 956a8923c6fc960f325c9e3b9149937ed0a0b990 Mon Sep 17 00:00:00 2001 From: Tom van Woudenberg Date: Fri, 8 Mar 2024 14:27:02 +0100 Subject: [PATCH 2/5] Update requirements.txt --- requirements.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index d40dcd3..ad037b3 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,7 +4,7 @@ jupyterlite-xeus-python jupyterlite-sphinx --extra-index-url https://gitlab.tudelft.nl/api/v4/projects/11239/packages/pypi/simple -sphinx-thebe == 0.2.1000 +sphinx-thebe ~= 0.9.9 --extra-index-url https://gitlab.tudelft.nl/api/v4/projects/17983/packages/pypi/simple jupyterbook_patches ~= 0.1.4 -download_link_replacer @ git+https://gitlab.tudelft.nl/mude/sphinx-download-link-replacer@dlr-0.1.2 +download_link_replacer @ git+https://gitlab.tudelft.nl/mude/sphinx-download-link-replacer From 1baacc90caa5ea41e6267b1adf69957149b0277c Mon Sep 17 00:00:00 2001 From: Tom van Woudenberg Date: Fri, 8 Mar 2024 14:33:26 +0100 Subject: [PATCH 3/5] Removed await ipywidgets --- book/features/exercise_checking.ipynb | 4 ---- 1 file changed, 4 deletions(-) diff --git a/book/features/exercise_checking.ipynb b/book/features/exercise_checking.ipynb index 83445c7..f77efc9 100644 --- a/book/features/exercise_checking.ipynb +++ b/book/features/exercise_checking.ipynb @@ -10,8 +10,6 @@ "\n", "A function has been made to check the value of a variable. As input values it takes the variable name, the expected value (correct answer) and how these values should be compared. You need to add this function to each page, including the imports, and add the `thebe-remove-input-init` tag to the cell.\n", "```python\n", - "import micropip\n", - "await micropip.install(\"ipywidgets\")\n", "import ipywidgets as widgets\n", "from IPython.display import display\n", "import operator\n", @@ -46,8 +44,6 @@ }, "outputs": [], "source": [ - "import micropip\n", - "await micropip.install(\"ipywidgets\")\n", "import ipywidgets as widgets\n", "from IPython.display import display\n", "import operator\n", From 652174fbe001d84927c8b0a27dca9f985cae784d Mon Sep 17 00:00:00 2001 From: Tom van Woudenberg Date: Fri, 8 Mar 2024 14:35:10 +0100 Subject: [PATCH 4/5] Update live_code.md --- book/features/live_code.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/book/features/live_code.md b/book/features/live_code.md index 505356f..934f9a5 100644 --- a/book/features/live_code.md +++ b/book/features/live_code.md @@ -8,7 +8,7 @@ To set up the Python live coding you need to add our [own sphinx-thebe extension For `requirements.txt` add the following lines: ``` --extra-index-url https://gitlab.tudelft.nl/api/v4/projects/11239/packages/pypi/simple -sphinx-thebe == 0.2.1000 +sphinx-thebe ~= 0.9.9 ``` This will download the correct version of the sphinx extension when the book is build on the server (which loads the required packages from `requirements.txt`) From a661ecf3f994b71d37748fdc67c040d81e438889 Mon Sep 17 00:00:00 2001 From: Tom van Woudenberg Date: Mon, 11 Mar 2024 09:01:43 +0100 Subject: [PATCH 5/5] Update sphinx-thebe documentation as discussed in https://gitlab.tudelft.nl/interactivetextbooks-citg/extensions/sphinx-thebe/-/issues/7#note_229711 --- book/features/live_code.md | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/book/features/live_code.md b/book/features/live_code.md index 934f9a5..3ae3085 100644 --- a/book/features/live_code.md +++ b/book/features/live_code.md @@ -15,18 +15,18 @@ This will download the correct version of the sphinx extension when the book is Afterwards, this sphinx extension needs to be enabled in your book. This can be done by adding the following lines to `_config.yml`: ``` -launch_buttons: - thebe: true - sphinx: html_js_files: - https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.4/require.min.js thebe_config: use_thebe_lite: true exclude_patterns: ["**/_*.yml", "**/*.md", "**/*.ipynb"] + html_theme_options: + launch_buttons: + thebe: true ``` -By `launch_buttons` you initiate the {fa}`rocket` --> {guilabel}`Live Code` on the top right corner of every page generated from a `.ipynb` file. The `html_js_files` link calls for some required javascript files. `use_thebe_lite` makes sure you initiate our adapted sphinx thebe extensions. The `exclude_patterns` makes sure you import all files so that they can be accessed from your code, except for the files matching the patterns shown. +The `html_js_files` link calls for some required javascript files. `use_thebe_lite` makes sure you initiate our adapted sphinx thebe extensions. The `exclude_patterns` makes sure you import all files so that they can be accessed from your code, except for the files matching the patterns shown. By `launch_buttons` you initiate the {fa}`rocket` --> {guilabel}`Live Code` on the top right corner of every page generated from a `.ipynb` file. As opposed to the jupyter book documentation, this button has to be specified from within `sphinx: html_theme_options` where you might also specify other buttons as well (ie. the [code repository button](https://jupyterbook.org/en/stable/basics/repository.html)). ## Instructions: local build @@ -44,5 +44,4 @@ With the extended functionality of live code, additional cell tags have been dev - `disable-execution-page` disables the ability to execute the entire page. This might be useful if you use python code for creating a page, but the code is not part of the actual content of the book. - `auto-execute-page` automatically starts the thebe live coding functionality whenever the page is opened. This is particularly useful if you're using widgets on a page. - `thebe-init` directly starts running this cell as soon as the thebe live coding functionality starts. -- `thebe-remove-input-init`, as `thebe-init`, starts the cell directly as soon as the thebe live coding functionality starts. However, the input is not shown to the students (in static and interactive mode). The original `remove-input` tag will not work as it deletes the entire cell, so it can never be executed. - +- `thebe-remove-input-init`, as `thebe-init`, starts the cell directly as soon as the thebe live coding functionality starts. However, the input is not shown to the students (in static and interactive mode). The original `remove-input` tag will not work as it deletes the entire cell, so it can never be executed. \ No newline at end of file