Skip to content

Commit 5a9bd2b

Browse files
authored
Update dependencies and examples (#218)
1 parent b0cbe56 commit 5a9bd2b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+1131
-4224
lines changed

.github/workflows/ci-build.yaml

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,55 @@
11
name: CI
22
on: [push, pull_request]
33

4+
concurrency:
5+
group: ${{ github.workflow }}-${{ github.ref }}
6+
cancel-in-progress: true
7+
48
jobs:
59
build-and-deploy:
610
runs-on: ubuntu-latest
11+
defaults:
12+
run:
13+
shell: bash -l {0}
714
steps:
815
- name: Checkout source
916
uses: actions/checkout@v2
1017

18+
- name: Cache conda
19+
uses: actions/cache@v2
20+
env:
21+
# Increase this value to reset cache if binder/environment.yml has not changed
22+
CACHE_NUMBER: 0
23+
with:
24+
path: ~/conda_pkgs_dir
25+
key:
26+
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{ hashFiles('binder/environment.yml') }}
27+
1128
- name: Setup Conda Environment
1229
uses: conda-incubator/setup-miniconda@v2
1330
with:
14-
miniconda-version: "latest"
31+
miniforge-variant: Mambaforge
32+
miniforge-version: latest
1533
environment-file: binder/environment.yml
1634
activate-environment: dask-examples
1735
auto-activate-base: false
36+
use-only-tar-bz2: true
1837

1938
- name: Install testing and docs dependencies
20-
shell: bash -l {0}
2139
run: |
22-
conda install -q pathlib nbconvert nbformat jupyter_client ipykernel
23-
pip install nbsphinx dask-sphinx-theme>=2 sphinx
40+
mamba install nbconvert nbformat jupyter_client ipykernel nbmake \
41+
pytest nbsphinx dask-sphinx-theme>=2 sphinx
2442
2543
- name: Execute Notebooks
26-
shell: bash -l {0}
2744
run: |
28-
pip install nbmake==0.1 pytest-xdist
2945
pytest \
30-
-n=auto \
46+
-vv \
3147
--nbmake \
3248
--overwrite \
33-
--forked \
3449
--ignore machine-learning/torch-prediction.ipynb \
3550
--ignore applications/json-data-on-the-web.ipynb
3651
3752
- name: Build
38-
shell: bash -l {0}
3953
run: sphinx-build -M html . _build -v
4054

4155
- name: Deploy

.github/workflows/ci-repo2docker.yaml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,25 @@
11
name: repo2docker CI
2-
32
on: [push, pull_request]
43

4+
concurrency:
5+
group: ${{ github.workflow }}-${{ github.ref }}
6+
cancel-in-progress: true
7+
58
jobs:
69
build:
710
runs-on: ubuntu-latest
811
steps:
912
- name: Checkout
1013
uses: actions/checkout@v2
1114

12-
- name: Set up Python 3.7
13-
uses: actions/setup-python@v1
15+
- name: Set up Python 3.9
16+
uses: actions/setup-python@v2
1417
with:
15-
python-version: 3.7
18+
python-version: 3.9
1619

1720
- name: Install repo2docker
1821
run: |
1922
python -m pip install --upgrade pip
20-
python -m pip install jupyter-repo2docker \
21-
six chardet # See https://github.com/jupyterhub/repo2docker/issues/1065
22-
23+
python -m pip install jupyter-repo2docker
2324
- name: Build dask-examples Docker image
2425
run: jupyter-repo2docker --no-run --debug .
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Update Dependencies
2+
on: [push, pull_request]
3+
4+
concurrency:
5+
group: ${{ github.workflow }}-${{ github.ref }}
6+
cancel-in-progress: true
7+
8+
jobs:
9+
update-dependencies:
10+
runs-on: ubuntu-latest
11+
defaults:
12+
run:
13+
shell: bash -l {0}
14+
steps:
15+
- name: Checkout source
16+
uses: actions/checkout@v2
17+
18+
- name: Cache conda
19+
uses: actions/cache@v2
20+
env:
21+
# Increase this value to reset cache if binder/environment-base.yml has not changed
22+
CACHE_NUMBER: 0
23+
with:
24+
path: ~/conda_pkgs_dir
25+
key:
26+
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{ hashFiles('binder/environment-base.yml') }}
27+
28+
- name: Setup Conda Environment
29+
uses: conda-incubator/setup-miniconda@v2
30+
with:
31+
miniforge-variant: Mambaforge
32+
miniforge-version: latest
33+
environment-file: binder/environment-base.yml
34+
auto-activate-base: false
35+
activate-environment: dask-examples
36+
use-only-tar-bz2: true
37+
38+
- name: Install dependencies
39+
run: |
40+
mamba install nbconvert nbformat jupyter_client ipykernel nbmake pytest-xdist
41+
42+
- name: Execute Notebooks
43+
run: |
44+
pytest \
45+
-vv \
46+
-n=auto \
47+
--forked \
48+
--nbmake \
49+
--overwrite \
50+
--ignore machine-learning/torch-prediction.ipynb \
51+
--ignore applications/json-data-on-the-web.ipynb

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,11 @@ _build/
44
mydask.png
55
dataframes/data
66
.idea/
7+
data/
8+
.vscode/
9+
applications/*.gif
10+
applications/*.img
11+
*.csv
12+
*.tif
13+
*.json
14+
machine-learning/data.zip

README.md

Lines changed: 51 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -17,30 +17,54 @@ This repository is a great opportunity to start contributing to Dask.
1717
Please note that examples submitted to this repository should follow these
1818
guidelines:
1919

20-
1. Run top-to-bottom without intervention from the user
21-
2. Not require external data sources that may disappear over time
22-
(external data sources that are highly unlikely to disappear are fine)
23-
3. Not be resource intensive, and should run within 2GB of memory
24-
4. Be clear and contain enough prose to explain the topic at hand
25-
5. Be concise and limited to one or two topics, such that a reader can
26-
get through the example within a few minutes of reading
27-
6. Be of general relevance to Dask users, and so not too specific on a
28-
particular problem or use case
29-
30-
As an example "how to do dataframe joins" is a great topic while "how to
31-
do dataframe joins in the particular case when one column is a categorical
32-
and the other is object dtype" is probably too specific
33-
7. If the example requires a library not included in `binder/environment.yml`
34-
then it would be `pip` installed` in the first cell of the notebook, with a
35-
brief explanation about what functionality the library adds. A brief
36-
example follows:
37-
38-
```
39-
### Install Extra Dependencies
40-
41-
We first install the library X for interacting with Y
42-
```
43-
44-
```
45-
!pip install X
46-
```
20+
1. Run top-to-bottom without intervention from the user
21+
2. Not require external data sources that may disappear over time
22+
(external data sources that are highly unlikely to disappear are fine)
23+
3. Not be resource intensive, and should run within 2GB of memory
24+
4. Be clear and contain enough prose to explain the topic at hand
25+
5. Be concise and limited to one or two topics, such that a reader can
26+
get through the example within a few minutes of reading
27+
6. Be of general relevance to Dask users, and so not too specific on a
28+
particular problem or use case
29+
30+
As an example "how to do dataframe joins" is a great topic while "how to
31+
do dataframe joins in the particular case when one column is a categorical
32+
and the other is object dtype" is probably too specific
33+
7. If the example requires a library not included in `binder/environment.yml`
34+
then it would be `pip` installed` in the first cell of the notebook, with a
35+
brief explanation about what functionality the library adds. A brief
36+
example follows:
37+
38+
```markdown
39+
### Install Extra Dependencies
40+
41+
We first install the library X for interacting with Y
42+
```
43+
44+
```python
45+
!pip install X
46+
```
47+
48+
Updating the Binder environment
49+
-------------------------------
50+
51+
1. Modify `binder/environment-base.yml` with new or updated dependencies
52+
2. Run a `linux/amd64` Docker container with `mamba` available. For example:
53+
54+
```shell
55+
docker run --platform=linux/amd64 -it --rm --mount type=bind,source=$(pwd)/binder,target=/binder condaforge/mambaforge /bin/bash
56+
```
57+
58+
This mounts the `./binder` folder in `/binder` in the Docker container
59+
3. Create the environment
60+
61+
```shell
62+
mamba env create -f environment-base.yml
63+
```
64+
65+
This may take quite a while.
66+
4. Export the environment specification:
67+
68+
```shell
69+
mamba env export -n dask-examples --no-builds -f environment.yml
70+
```

applications/async-await.ipynb

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -150,18 +150,11 @@
150150
" asyncio.get_event_loop().run_until_complete(f())\n",
151151
"```"
152152
]
153-
},
154-
{
155-
"cell_type": "code",
156-
"execution_count": null,
157-
"metadata": {},
158-
"outputs": [],
159-
"source": []
160153
}
161154
],
162155
"metadata": {
163156
"kernelspec": {
164-
"display_name": "Python 3",
157+
"display_name": "Python 3 (ipykernel)",
165158
"language": "python",
166159
"name": "python3"
167160
},
@@ -175,7 +168,7 @@
175168
"name": "python",
176169
"nbconvert_exporter": "python",
177170
"pygments_lexer": "ipython3",
178-
"version": "3.7.1"
171+
"version": "3.9.12"
179172
}
180173
},
181174
"nbformat": 4,

applications/async-web-server.ipynb

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
"cell_type": "code",
1919
"execution_count": null,
2020
"metadata": {
21-
"collapsed": false,
2221
"jupyter": {
2322
"outputs_hidden": false
2423
}
@@ -70,7 +69,6 @@
7069
"cell_type": "code",
7170
"execution_count": null,
7271
"metadata": {
73-
"collapsed": false,
7472
"jupyter": {
7573
"outputs_hidden": false
7674
}
@@ -111,7 +109,6 @@
111109
"cell_type": "code",
112110
"execution_count": null,
113111
"metadata": {
114-
"collapsed": false,
115112
"jupyter": {
116113
"outputs_hidden": false
117114
}
@@ -125,7 +122,6 @@
125122
"cell_type": "code",
126123
"execution_count": null,
127124
"metadata": {
128-
"collapsed": false,
129125
"jupyter": {
130126
"outputs_hidden": false
131127
}
@@ -139,7 +135,6 @@
139135
"cell_type": "code",
140136
"execution_count": null,
141137
"metadata": {
142-
"collapsed": false,
143138
"jupyter": {
144139
"outputs_hidden": false
145140
}
@@ -153,7 +148,6 @@
153148
"cell_type": "code",
154149
"execution_count": null,
155150
"metadata": {
156-
"collapsed": false,
157151
"jupyter": {
158152
"outputs_hidden": false
159153
}
@@ -176,7 +170,6 @@
176170
"cell_type": "code",
177171
"execution_count": null,
178172
"metadata": {
179-
"collapsed": false,
180173
"jupyter": {
181174
"outputs_hidden": false
182175
}
@@ -225,7 +218,6 @@
225218
"cell_type": "code",
226219
"execution_count": null,
227220
"metadata": {
228-
"collapsed": false,
229221
"jupyter": {
230222
"outputs_hidden": false
231223
}
@@ -285,7 +277,6 @@
285277
"cell_type": "code",
286278
"execution_count": null,
287279
"metadata": {
288-
"collapsed": false,
289280
"jupyter": {
290281
"outputs_hidden": false
291282
}
@@ -300,7 +291,6 @@
300291
"cell_type": "code",
301292
"execution_count": null,
302293
"metadata": {
303-
"collapsed": false,
304294
"jupyter": {
305295
"outputs_hidden": false
306296
}
@@ -326,7 +316,6 @@
326316
"cell_type": "code",
327317
"execution_count": null,
328318
"metadata": {
329-
"collapsed": false,
330319
"jupyter": {
331320
"outputs_hidden": false
332321
}
@@ -344,7 +333,6 @@
344333
"cell_type": "code",
345334
"execution_count": null,
346335
"metadata": {
347-
"collapsed": false,
348336
"jupyter": {
349337
"outputs_hidden": false
350338
}
@@ -376,7 +364,6 @@
376364
"cell_type": "code",
377365
"execution_count": null,
378366
"metadata": {
379-
"collapsed": false,
380367
"jupyter": {
381368
"outputs_hidden": false
382369
}
@@ -395,7 +382,7 @@
395382
],
396383
"metadata": {
397384
"kernelspec": {
398-
"display_name": "Python 3",
385+
"display_name": "Python 3 (ipykernel)",
399386
"language": "python",
400387
"name": "python3"
401388
},
@@ -409,7 +396,7 @@
409396
"name": "python",
410397
"nbconvert_exporter": "python",
411398
"pygments_lexer": "ipython3",
412-
"version": "3.7.4"
399+
"version": "3.9.12"
413400
}
414401
},
415402
"nbformat": 4,

0 commit comments

Comments
 (0)