Skip to content

Commit de6e75f

Browse files
committed
README: adding dependencies
1 parent c6f2480 commit de6e75f

File tree

1 file changed

+52
-26
lines changed

1 file changed

+52
-26
lines changed

README.md

Lines changed: 52 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -36,39 +36,46 @@ In summary, we adapt a textbook example from Nelson (2013): a terminating discre
3636

3737
> *Nelson. B.L. (2013). [Foundations and methods of stochastic simulation](https://www.amazon.co.uk/Foundations-Methods-Stochastic-Simulation-International/dp/1461461596/ref=sr_1_1?dchild=1&keywords=foundations+and+methods+of+stochastic+simulation&qid=1617050801&sr=8-1). Springer.*
3838
39-
## Try it in your browser
39+
## 3. Try it in your browser
4040

41-
https://pythonhealthdatascience.github.io/stars-simpy-jupterlite/notebooks/?path=01_urgent_care_model.ipynb
41+
* Classic notebook: https://pythonhealthdatascience.github.io/stars-simpy-jupterlite/notebooks/?path=01_urgent_care_model.ipynb
42+
* Jupyterlab: https://pythonhealthdatascience.github.io/stars-simpy-jupterlite
4243

43-
## ≠ How does it compare to the Pyodide kernel?
44+
## 4. Customise your simulation environment
4445

45-
#### Pyodide kernel:
46+
## 📦 How to install extra packages for your DES model.
4647

47-
- Is based on [Pyodide](https://github.com/pyodide/pyodide)
48-
- Uses [IPython](https://github.com/ipython/ipython) for the code execution (access to IPython magics, support for the inline Matplotlib backend, *etc*)
49-
- Provides a way to dynamically install packages with ``piplite`` (**e.g.** ``await piplite.install("ipywidgets")``)
50-
- **Does not support** sleeping with ``from time import sleep``
51-
- **Does not support** pre-installing packages
48+
The repo contains two environment files. To install more dependencies for your DES model and analysis you need to edit the ``environment.yml`` file.
5249

53-
#### jupyterlite-xeus-python:
50+
The template ``environment.yml`` is as follows:
5451

55-
- Is based on [xeus-python](https://github.com/jupyter-xeus/xeus-python)
56-
- Uses [IPython](https://github.com/ipython/ipython) for the code execution (access to IPython magics, support for the inline Matplotlib backend, *etc*)
57-
- **Does not provide** a way to dynamically install packages (yet. We are working on building a ``mamba`` package manager for WASM)
58-
- **Supports** sleeping with ``from time import sleep``
59-
- **Supports** pre-installing packages from ``emscripten-forge`` and ``conda-forge``, by providing an ``environment.yml`` file defining the runtime environment
6052

61-
## 💡 How to make your own deployment
62-
63-
![Deploy your own](deploy.gif)
53+
```yml
54+
name: xeus-python-kernel
55+
channels:
56+
- https://repo.mamba.pm/emscripten-forge
57+
- conda-forge
58+
dependencies:
59+
- xeus-python
60+
- ipycanvas
61+
- simpy=4.1.1
62+
- numpy
63+
- pandas
64+
- matplotlib
65+
```
6466
65-
Then your site will be published under https://{USERNAME}.github.io/{DEMO_REPO_NAME}
67+
**Key points:**
6668
67-
## 📦 How to install extra packages
69+
* There are two channels in use.
70+
* `encription-forge` contains specific versions of the packages for web assembly These include `numpy` `pandas`, and `matplotlib`. Other popular packages include `scipy`, `scikit-learn` and `pytest`.
71+
* `conda-forge` for other installs you can use conda-forge. Only ``no-arch`` packages from ``conda-forge`` can be installed (simpy qualifies)
72+
* Note that `numpy`, `pandas` and `matplotlib` have specific versions available on `enscription-forge`. For this reason we recommend not including the package version number.
73+
* `simpy` is installed from `conda-forge` we were therefore able to freeze the version to 4.1.1 to aid reproducibility.
74+
* At the time of writing the xeus-python kernal will use python 3.11.3
6875

69-
You can pre-install extra packages for xeus-python by adding them to the ``environment.yml`` file.
76+
As an example modification assume that you wanted to add two new packages: `plotly` and `scipy`. The first `plotly` is available ``no-arch`` from conda-forge so it is safe to include and if you wanted to you could try to include a version number. There is a specific version of `scipy` is available on `encription-forge`
7077

71-
For example, if you want to create a JupyterLite deployment with NumPy and Matplotlib pre-installed, you would need to edit the ``environment.yml`` file as following:
78+
Our modified environment looks like:
7279

7380
```yml
7481
name: xeus-python-kernel
@@ -77,11 +84,30 @@ channels:
7784
- conda-forge
7885
dependencies:
7986
- xeus-python
87+
- ipycanvas
88+
- simpy=4.1.1
8089
- numpy
90+
- pandas
8191
- matplotlib
92+
- plotly
93+
- scipy
8294
```
8395

84-
Only ``no-arch`` packages from ``conda-forge`` and packages from ``emscripten-forge`` can be installed.
85-
- **How do I know if a package is ``no-arch`` on ``conda-forge``?** ``no-arch`` means that the package is OS-independent, usually pure-python packages are ``no-arch``. To check if your package is ``no-arch`` on ``conda-forge``, check if the "Platform" entry is "no-arch" in the https://beta.mamba.pm/channels/conda-forge?tab=packages page. If your package is not ``no-arch`` but is a pure Python package, then you should probably update the feedstock to turn your package into a ``no-arch`` one.
86-
![](noarch.png)
87-
- **How do I know if my package is on ``emscripten-forge``?** You can see the list of packages pubished on ``emscripten-forge`` [here](https://beta.mamba.pm/channels/emscripten-forge?tab=packages). In case your package is missing, or it's not up-to-date, feel free to open an issue or a PR on https://github.com/emscripten-forge/recipes.
96+
If you wanted to use an alternative simulation package to `simpy` this would need to be available on `conda-forge` and be ``no-arch``. An example package is `salabim`. A modification of the enviroment is:
97+
98+
99+
```yml
100+
name: xeus-python-kernel
101+
channels:
102+
- https://repo.mamba.pm/emscripten-forge
103+
- conda-forge
104+
dependencies:
105+
- xeus-python
106+
- ipycanvas
107+
- salabim
108+
- numpy
109+
- pandas
110+
- matplotlib
111+
- plotly
112+
- scipy
113+
```

0 commit comments

Comments
 (0)