From b87b2e037c5917cecf4e5b3aebaf4f922e77a65e Mon Sep 17 00:00:00 2001 From: Tom van Woudenberg Date: Thu, 7 Mar 2024 08:59:39 +0100 Subject: [PATCH 1/2] Added instructions on how to add additional packagaes --- book/features/live_code.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/book/features/live_code.md b/book/features/live_code.md index 505356f..b925096 100644 --- a/book/features/live_code.md +++ b/book/features/live_code.md @@ -46,3 +46,22 @@ With the extended functionality of live code, additional cell tags have been dev - `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. +## Additional packages + +The python kernel doesn't have all packages standard included. Some of the most used packages which are included are: +- `python` +- `numpy` +- `matplotlib` +- `ipywidgets` + +If you'd like to install more package, you can do so by added a codecell (preferably hidden using `thebe-remove-input-init`) with the following command: +```{python} +import micropip +await micropip.install("package_name") +``` +This will install the packages from Pyodide. + +If the packages are not included in Pyodide, you can use `pip: +```{python} +%pip install package_name +``` From 7c9724e76a1e736c2e958068c556ade41bf66bca Mon Sep 17 00:00:00 2001 From: Tom van Woudenberg Date: Wed, 13 Mar 2024 16:38:27 +0100 Subject: [PATCH 2/2] Updates after review max --- book/features/live_code.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/book/features/live_code.md b/book/features/live_code.md index de058a9..ec52743 100644 --- a/book/features/live_code.md +++ b/book/features/live_code.md @@ -69,6 +69,8 @@ With the extended functionality of live code, additional cell tags have been dev The python kernel doesn't have all packages standard included. Some of the most used packages which are included are: - `python` - `numpy` +- `scipy` +- `sympy` - `matplotlib` - `ipywidgets` @@ -77,7 +79,7 @@ If you'd like to install more package, you can do so by added a codecell (prefer import micropip await micropip.install("package_name") ``` -This will install the packages from Pyodide. +This will install the packages: Micropip will look at the Pyodide package index, but also at the general PyPi index. If a package is pure python (i.e. no C extensions), then it can also be used by Pyodide. If the packages are not included in Pyodide, you can use `pip: ```{python}