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", diff --git a/book/features/jupyterlite/configuration.md b/book/features/jupyterlite/configuration.md index ad3ba09..2a6f036 100644 --- a/book/features/jupyterlite/configuration.md +++ b/book/features/jupyterlite/configuration.md @@ -11,7 +11,7 @@ You can install these using `pip`. Make sure these are also defined in the `requ There are multiple Python kernels available that work in the browser. Two popular ones are [Pyodide] and [`Xeus-Python`]. The latter allows you to install packages from `conda-forge` during build time, making them immediately available on your website. In this example, `Xeus-Python` will be used. -When you have installed `jupyterlite-xeus-python`, the kernel will automatically be included in the build without any configuration. However, the default kernel only comes with `numpy`, and we want to make sophisticated interactive content, for example with `matplotlib` and `ipywidgets`. `Xeus-Python` can install these packages itself with `conda`. All we need to do is give it a list of the packages we want installed. To this end, we need to make a configuration file for `jupyterlite` containing settings that will be passed to `Xeus-Python`. The configuration file needs to be in JSON format, and needs to be placed in the root directory of your repository (where `requirements.txt` and `.gitlab-ci.yml` live). In this file, we can specify which packages need to be installed in the kernel as follows: +When you have installed `jupyterlite-xeus-python`, the kernel will automatically be included in the build without any configuration. However, the default kernel only comes with `numpy`, and we want to make sophisticated interactive content, for example with `matplotlib` and `ipywidgets`. `Xeus-Python` can install these packages itself with `conda`. All we need to do is give it a list of the packages we want installed. To this end, we need to make a configuration file for `jupyterlite` containing settings that will be passed to `Xeus-Python`. The configuration file needs to be in JSON format, and needs to be placed in the root directory of your book (where `_config.yml` lives). In this file, we can specify which packages need to be installed in the kernel as follows: { "XeusPythonEnv": { diff --git a/book/features/live_code.md b/book/features/live_code.md index b925096..a8be21a 100644 --- a/book/features/live_code.md +++ b/book/features/live_code.md @@ -8,25 +8,25 @@ 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`) 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 diff --git a/jupyterlite-config.json b/book/jupyterlite-config.json similarity index 100% rename from jupyterlite-config.json rename to book/jupyterlite-config.json diff --git a/requirements.txt b/requirements.txt index a3dc6e5..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.2 -download_link_replacer @ git+https://gitlab.tudelft.nl/mude/sphinx-download-link-replacer@dlr-0.1.2 +jupyterbook_patches ~= 0.1.4 +download_link_replacer @ git+https://gitlab.tudelft.nl/mude/sphinx-download-link-replacer