Skip to content

Commit 2396535

Browse files
committed
update "sharing" episode; closes #40
1 parent 8b7653e commit 2396535

File tree

5 files changed

+42
-25
lines changed

5 files changed

+42
-25
lines changed

content/index.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ and share **reproducible plots** using
4747
- Managing environments and installing Python packages.
4848

4949

50+
(episode-overview)=
51+
5052
## Episode overview
5153

5254
Day 1 morning:

content/installation.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
(installation)=
2+
13
# Software install instructions
24

35
[this page is adapted from <https://aaltoscicomp.github.io/python-for-scicomp/installation/>]

content/sharing.md

Lines changed: 27 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,43 @@
11
# Sharing notebooks
22

3-
```{objectives}
3+
:::{objectives}
44
- Know about good practices for notebooks to make them reusable
55
- Have a recipe to share a dynamic and reproducible visualization pipeline
6-
```
7-
8-
```{instructor-note}
9-
- 20 min presentation and discussion
10-
```
6+
:::
117

12-
[this lesson is adapted from <https://coderefinery.github.io/jupyter/sharing/>]
8+
[this lesson is adapted after <https://coderefinery.github.io/jupyter/sharing/>]
139

1410

1511
## Document dependencies
1612

1713
If you import libraries into your notebook, note down their versions.
1814

19-
It is customary to do this either in a `requirements.txt` file (example):
15+
In Python, it is customary to do this either in a `requirements.txt` file (example):
2016
```text
21-
pandas==2.2.2
22-
altair==5.3.0
17+
jupyterlab
18+
altair == 5.5.0
19+
vega_datasets
20+
pandas == 2.2.3
21+
numpy == 2.1.2
2322
```
2423

2524
... or in an `environment.yml` file (example):
2625
```yaml
27-
name: example-environment
26+
name: data-viz
2827
channels:
2928
- conda-forge
3029
dependencies:
31-
- pandas=2.2.2
32-
- altair=5.3.0
30+
- python <= 3.12
31+
- jupyterlab
32+
- altair-all = 5.5.0
33+
- vega_datasets
34+
- pandas = 2.2.3
35+
- numpy = 2.1.2
3336
```
3437
38+
By the way, this is almost the same `environment.yml` file that we used to install the local software
39+
environment in the {ref}`installation` (the latter did not pin versions).
40+
3541
Place either `requirements.txt` or `environment.yml` in the same folder as the notebook(s).
3642

3743
This is not only useful for people who will try to rerun this in future, it is also
@@ -46,7 +52,7 @@ to share them with our future selves (backup and reproducibility).
4652
- You can enter a URL, GitHub repo or username, or GIST ID in [nbviewer](https://nbviewer.jupyter.org/) and view a rendered Jupyter notebook
4753
- Read the Docs can render Jupyter Notebooks via the [nbsphinx package](https://nbsphinx.readthedocs.io/)
4854
- [Binder](https://mybinder.org/) creates live notebooks based on a GitHub repository
49-
- [EGI Notebooks](https://notebooks.egi.eu) (see also https://egi-notebooks.readthedocs.io)
55+
- [EGI Notebooks](https://notebooks.egi.eu) (see also <https://egi-notebooks.readthedocs.io>)
5056
- [JupyterLab](https://github.com/jupyterlab/jupyterlab) supports sharing and collaborative editing of notebooks via Google Drive. Recently
5157
it also added support for [Shared editing with collaborative notebook model](https://github.com/jupyterlab/jupyterlab/pull/10118).
5258
- [JupyterLite](https://jupyterlite.readthedocs.io/en/latest/) creates a Jupyterlab environment in the browser and can be hosted as a GitHub page.
@@ -60,10 +66,10 @@ to share them with our future selves (backup and reproducibility).
6066
- a slide-show in the browser
6167

6268

63-
These platforms can be used free of charge but have **paid subscriptions** for
69+
The following platforms can be used free of charge but have **paid subscriptions** for
6470
faster access to cloud resources:
6571
- [CoCalc](https://cocalc.com/) (formerly SageMathCloud) allows collaborative editing of notebooks in the cloud
66-
- Google's [Colaboratory](https://colab.research.google.com/) lets you work on notebooks in the cloud, and you can [read and write to notebook files on Drive](https://colab.research.google.com/notebooks/io.ipynb)
72+
- [Google Colab](https://colab.research.google.com/) lets you work on notebooks in the cloud, and you can [read and write to notebook files on Drive](https://colab.research.google.com/notebooks/io.ipynb)
6773
- [Microsoft Azure Notebooks](https://notebooks.azure.com/) also offers free notebooks in the cloud
6874
- [Deepnote](https://deepnote.com/) allows real-time collaboration
6975

@@ -78,8 +84,10 @@ Instructor demonstrates this:
7884
also [nbviewer](https://nbviewer.jupyter.org/).
7985
- Add a file `requirements.txt` which contains:
8086
```text
81-
pandas==2.2.2
82-
altair==5.3.0
87+
altair == 5.5.0
88+
vega_datasets
89+
pandas == 2.2.3
90+
numpy == 2.1.2
8391
```
8492
- Visit [https://mybinder.org](https://mybinder.org):
8593
```{figure} img/binder/binder.jpg
@@ -94,7 +102,7 @@ Instructor demonstrates this:
94102
::::
95103

96104
Also please see how we share the notebooks from this lesson
97-
in the [repository README](https://github.com/coderefinery/data-visualization-python/blob/main/README.md?plain=1).
105+
in the {ref}`episode-overview`.
98106

99107

100108
## How to get a digital object identifier (DOI)

notebooks/requirements-dev.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
jupyterlab
2+
altair >4, <6
3+
vega_datasets
4+
pandas
5+
numpy
6+
jupyterlab-code-formatter
7+
black
8+
isort

notebooks/requirements.txt

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
jupyterlab
2-
altair >4, <6
2+
altair == 5.5.0
33
vega_datasets
4-
pandas
5-
numpy
6-
jupyterlab-code-formatter
7-
black
8-
isort
4+
pandas == 2.2.3
5+
numpy == 2.1.2

0 commit comments

Comments
 (0)