Skip to content

Commit 46821aa

Browse files
authored
Merge pull request #26 from fangohr/repo2docker-container-tests
Repo2docker container tests
2 parents 1c868d7 + edc1e08 commit 46821aa

File tree

7 files changed

+91
-61
lines changed

7 files changed

+91
-61
lines changed

.github/workflows/binder-nbval.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: NBVAL on binder container
2+
3+
# We use `repo2docker` to build the docker image. Same as would happen on myBinder (or other Binder instances)
4+
5+
on:
6+
pull_request:
7+
branches: [ master ]
8+
9+
jobs:
10+
11+
repo2docker-build-and-test:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: Build Docker Container with repo2docker
17+
uses: jupyterhub/repo2docker-action@master
18+
with:
19+
NO_PUSH: 'true'
20+
IMAGE_NAME: "python4compscience"
21+
22+
- name: List Available Images
23+
run: docker images
24+
25+
- name: Test with nbval
26+
run: make docker-binder-nbval
27+

.github/workflows/stage.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,15 +56,15 @@ jobs:
5656
# env:
5757
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5858
# NETLIFY_DIR: ./book/_build/html
59-
#
59+
#
6060
# - name: Publish Staging Site
6161
# id: netlify-deploy
6262
# uses: netlify/actions/cli@6c34c3fcafc69ac2e1d6dbf226560329c6dfc51b
6363
# with:
6464
# args: deploy --dir=./book/_build/html
6565
# env:
6666
# NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY }}
67-
#
67+
#
6868
# - uses: mshick/add-pr-comment@07f690343c25a94e24a8acb70d03c86b701ae322
6969
# with:
7070
# message: ${{ steps.netlify-deploy.outputs.NETLIFY_OUTPUT }}

Makefile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,13 @@ nbval:
2929
pytest -v --nbval-lax book/18-environments.ipynb
3030

3131

32+
nbval-native:
33+
@echo "Testing all chapters (apart from 18) with --nbval"
34+
pytest -v --nbval book --sanitize-with book/static/nbval_sanitize.cfg \
35+
--ignore=book/18-environments.ipynb --ignore=book/_build
36+
@echo "Testing chapter 18 with --nbval-lax"
37+
pytest -v --nbval-lax book/18-environments.ipynb
38+
3239

3340
docker-all:
3441
make docker-build
@@ -66,6 +73,9 @@ docker-nbval:
6673
docker-clean:
6774
$(DOCKER_RUN) make clean
6875

76+
docker-binder-nbval:
77+
$(DOCKER_RUN) make nbval-native
78+
6979
# to update the title page:
7080
# - screenshot first page of pdf
7181
# - (edit out date if desired)

Readme.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
<!-- markdown-link-check-disable -->
33
<!-- TODO: Enable this AFTER first merge and deploy to master! -->
44
![Book Deploy](https://github.com/fangohr/introduction-to-python-for-computational-science-and-engineering/workflows/Book%20Deploy/badge.svg)
5+
[![nbval in repo2docker container](https://github.com/fangohr/introduction-to-python-for-computational-science-and-engineering/actions/workflows/binder-nbval.yml/badge.svg)](https://github.com/fangohr/introduction-to-python-for-computational-science-and-engineering/actions/workflows/binder-nbval.yml)
56
<!-- markdown-link-check-enable -->
67
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.1411868.svg)](https://doi.org/10.5281/zenodo.1411868)
78
[![License: CC BY-NC 4.0](https://img.shields.io/badge/License-CC%20BY--NC%204.0-lightgrey.svg)](https://creativecommons.org/licenses/by-nc/4.0/)

binder/info.org

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,3 @@ leaner definition of dependencies.
1212
Binder should look in this directory (as it is called 'binder') and ignore the
1313
global Dockerfile.
1414

15-
* Re-use dependencies from development environment in myBinder
16-
17-
I don't know if myBinder could read dependencies from a pyproject.toml file (and
18-
couldn't find any documentation on this yet), nor if we can extract a
19-
requirements.txt file from the pyproject.toml file automatically.
20-
21-
As a first step towards making the binder image leaner, I will stick to a definition via a Dockerfile, and leave out latex to make it smaller.
22-
23-
This didn't go so well.
24-
25-
Next attempt: specifying the packages we need in requirements.txt directly. It's
26-
not ideal, as we don't run tests on the particular versions, and we duplicate
27-
some effort from ../pyproject.toml here in reqiuirements.txt. On the positive
28-
side, Binder start-up time could be much smaller (and Binder work at all).
29-
30-

binder/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ pandas
66
pyarrow
77
ipython
88
pytest
9+
nbval

book/18-environments.ipynb

Lines changed: 50 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
"name": "stdout",
7171
"output_type": "stream",
7272
"text": [
73-
"Tue Jan 4 16:03:43 CET 2022\r\n"
73+
"Wed Jan 5 11:55:11 CET 2022\r\n"
7474
]
7575
}
7676
],
@@ -272,7 +272,7 @@
272272
"name": "stdout",
273273
"output_type": "stream",
274274
"text": [
275-
"drwxr-xr-x 6 fangohr staff 192 Jan 4 16:03 \u001b[34mmyvirtualenv/\u001b[m\u001b[m\r\n"
275+
"drwxr-xr-x 6 fangohr staff 192 Jan 5 11:55 \u001b[34mmyvirtualenv/\u001b[m\u001b[m\r\n"
276276
]
277277
}
278278
],
@@ -777,20 +777,20 @@
777777
" Using cached beautifulsoup4-4.10.0-py3-none-any.whl (97 kB)\n",
778778
"Collecting requests<3.0.0,>=2.0.0\n",
779779
" Using cached requests-2.27.0-py2.py3-none-any.whl (63 kB)\n",
780-
"Collecting certifi>=2017.4.17\n",
781-
" Using cached certifi-2021.10.8-py2.py3-none-any.whl (149 kB)\n",
782-
"Collecting urllib3<1.27,>=1.21.1\n",
783-
" Using cached urllib3-1.26.7-py2.py3-none-any.whl (138 kB)\n",
784-
"Collecting charset-normalizer~=2.0.0\n",
785-
" Using cached charset_normalizer-2.0.9-py3-none-any.whl (39 kB)\n",
786780
"Collecting idna<4,>=2.5\n",
787781
" Using cached idna-3.3-py3-none-any.whl (61 kB)\n",
782+
"Collecting charset-normalizer~=2.0.0\n",
783+
" Using cached charset_normalizer-2.0.10-py3-none-any.whl (39 kB)\n",
784+
"Collecting urllib3<1.27,>=1.21.1\n",
785+
" Using cached urllib3-1.26.7-py2.py3-none-any.whl (138 kB)\n",
786+
"Collecting certifi>=2017.4.17\n",
787+
" Using cached certifi-2021.10.8-py2.py3-none-any.whl (149 kB)\n",
788788
"Collecting soupsieve>1.2\n",
789789
" Using cached soupsieve-2.3.1-py3-none-any.whl (37 kB)\n",
790790
"Using legacy 'setup.py install' for wikipedia, since package 'wheel' is not installed.\n",
791791
"Installing collected packages: urllib3, soupsieve, idna, charset-normalizer, certifi, requests, beautifulsoup4, wikipedia\n",
792792
" Running setup.py install for wikipedia ... \u001b[?25ldone\n",
793-
"\u001b[?25hSuccessfully installed beautifulsoup4-4.10.0 certifi-2021.10.8 charset-normalizer-2.0.9 idna-3.3 requests-2.27.0 soupsieve-2.3.1 urllib3-1.26.7 wikipedia-1.4.0\n"
793+
"\u001b[?25hSuccessfully installed beautifulsoup4-4.10.0 certifi-2021.10.8 charset-normalizer-2.0.10 idna-3.3 requests-2.27.0 soupsieve-2.3.1 urllib3-1.26.7 wikipedia-1.4.0\n"
794794
]
795795
}
796796
],
@@ -834,9 +834,9 @@
834834
"name": "stdout",
835835
"output_type": "stream",
836836
"text": [
837-
"Found existing installation: wikipedia 1.4.0\n",
838-
"Uninstalling wikipedia-1.4.0:\n",
839-
" Successfully uninstalled wikipedia-1.4.0\n"
837+
"Found existing installation: wikipedia 1.4.0\r\n",
838+
"Uninstalling wikipedia-1.4.0:\r\n",
839+
" Successfully uninstalled wikipedia-1.4.0\r\n"
840840
]
841841
}
842842
],
@@ -858,7 +858,7 @@
858858
"------------------ ---------\r\n",
859859
"beautifulsoup4 4.10.0\r\n",
860860
"certifi 2021.10.8\r\n",
861-
"charset-normalizer 2.0.9\r\n",
861+
"charset-normalizer 2.0.10\r\n",
862862
"idna 3.3\r\n",
863863
"pip 21.3.1\r\n",
864864
"requests 2.27.0\r\n",
@@ -1005,9 +1005,9 @@
10051005
"name": "stdout",
10061006
"output_type": "stream",
10071007
"text": [
1008-
"Found existing installation: cowsay 4.0\n",
1009-
"Uninstalling cowsay-4.0:\n",
1010-
" Successfully uninstalled cowsay-4.0\n"
1008+
"Found existing installation: cowsay 4.0\r\n",
1009+
"Uninstalling cowsay-4.0:\r\n",
1010+
" Successfully uninstalled cowsay-4.0\r\n"
10111011
]
10121012
}
10131013
],
@@ -1044,8 +1044,8 @@
10441044
"output_type": "stream",
10451045
"text": [
10461046
"Collecting git+https://github.com/VaasuDevanS/cowsay-python.git\n",
1047-
" Cloning https://github.com/VaasuDevanS/cowsay-python.git to /private/var/folders/wc/d1lyft3x2jn29b6yffrzh4vw0000gq/T/pip-req-build-3iclfhwr\n",
1048-
" Running command git clone --filter=blob:none -q https://github.com/VaasuDevanS/cowsay-python.git /private/var/folders/wc/d1lyft3x2jn29b6yffrzh4vw0000gq/T/pip-req-build-3iclfhwr\n",
1047+
" Cloning https://github.com/VaasuDevanS/cowsay-python.git to /private/var/folders/wc/d1lyft3x2jn29b6yffrzh4vw0000gq/T/pip-req-build-7gxyjbt6\n",
1048+
" Running command git clone --filter=blob:none -q https://github.com/VaasuDevanS/cowsay-python.git /private/var/folders/wc/d1lyft3x2jn29b6yffrzh4vw0000gq/T/pip-req-build-7gxyjbt6\n",
10491049
" Resolved https://github.com/VaasuDevanS/cowsay-python.git to commit 767c09425d813b80d67cdebba02ce387ca2eb4e8\n",
10501050
" Preparing metadata (setup.py) ... \u001b[?25ldone\n",
10511051
"\u001b[?25hUsing legacy 'setup.py install' for cowsay, since package 'wheel' is not installed.\n",
@@ -1120,7 +1120,7 @@
11201120
"remote: Counting objects: 100% (82/82), done.\u001b[K\n",
11211121
"remote: Compressing objects: 100% (40/40), done.\u001b[K\n",
11221122
"remote: Total 170 (delta 41), reused 77 (delta 40), pack-reused 88\u001b[K\n",
1123-
"Receiving objects: 100% (170/170), 79.19 KiB | 1.15 MiB/s, done.\n",
1123+
"Receiving objects: 100% (170/170), 79.19 KiB | 772.00 KiB/s, done.\n",
11241124
"Resolving deltas: 100% (72/72), done.\n"
11251125
]
11261126
}
@@ -1204,7 +1204,7 @@
12041204
}
12051205
],
12061206
"source": [
1207-
"!ls myvirtualenv/lib/python3.9/site-packages/cowsay\n"
1207+
"!ls myvirtualenv/lib/python3.*/site-packages/cowsay\n"
12081208
]
12091209
},
12101210
{
@@ -1225,9 +1225,9 @@
12251225
"name": "stdout",
12261226
"output_type": "stream",
12271227
"text": [
1228-
"Found existing installation: cowsay 4.0\n",
1229-
"Uninstalling cowsay-4.0:\n",
1230-
" Successfully uninstalled cowsay-4.0\n"
1228+
"Found existing installation: cowsay 4.0\r\n",
1229+
"Uninstalling cowsay-4.0:\r\n",
1230+
" Successfully uninstalled cowsay-4.0\r\n"
12311231
]
12321232
}
12331233
],
@@ -1275,12 +1275,12 @@
12751275
"name": "stdout",
12761276
"output_type": "stream",
12771277
"text": [
1278-
"-rw-r--r-- 1 fangohr staff 28 Jan 4 16:04 myvirtualenv/lib/python3.9/site-packages/cowsay.egg-link\r\n"
1278+
"-rw-r--r-- 1 fangohr staff 28 Jan 5 11:55 myvirtualenv/lib/python3.9/site-packages/cowsay.egg-link\r\n"
12791279
]
12801280
}
12811281
],
12821282
"source": [
1283-
"!ls -l myvirtualenv/lib/python3.9/site-packages/cowsay*\n"
1283+
"!ls -l myvirtualenv/lib/python3.*/site-packages/cowsay*\n"
12841284
]
12851285
},
12861286
{
@@ -1299,7 +1299,7 @@
12991299
}
13001300
],
13011301
"source": [
1302-
"!cat myvirtualenv/lib/python3.9/site-packages/cowsay*\n",
1302+
"!cat myvirtualenv/lib/python3.*/site-packages/cowsay*\n",
13031303
"\n"
13041304
]
13051305
},
@@ -1331,7 +1331,7 @@
13311331
"text": [
13321332
"beautifulsoup4==4.10.0\r\n",
13331333
"certifi==2021.10.8\r\n",
1334-
"charset-normalizer==2.0.9\r\n",
1334+
"charset-normalizer==2.0.10\r\n",
13351335
"-e git+https://github.com/VaasuDevanS/cowsay-python.git@767c09425d813b80d67cdebba02ce387ca2eb4e8#egg=cowsay\r\n",
13361336
"idna==3.3\r\n",
13371337
"requests==2.27.0\r\n",
@@ -1374,7 +1374,7 @@
13741374
"text": [
13751375
"beautifulsoup4==4.10.0\r\n",
13761376
"certifi==2021.10.8\r\n",
1377-
"charset-normalizer==2.0.9\r\n",
1377+
"charset-normalizer==2.0.10\r\n",
13781378
"-e git+https://github.com/VaasuDevanS/cowsay-python.git@767c09425d813b80d67cdebba02ce387ca2eb4e8#egg=cowsay\r\n",
13791379
"idna==3.3\r\n",
13801380
"requests==2.27.0\r\n",
@@ -1416,21 +1416,28 @@
14161416
"output_type": "stream",
14171417
"text": [
14181418
"Obtaining cowsay from git+https://github.com/VaasuDevanS/cowsay-python.git@767c09425d813b80d67cdebba02ce387ca2eb4e8#egg=cowsay (from -r requirements.txt (line 4))\n",
1419-
" Skipping because already up-to-date.\n",
1420-
"Requirement already satisfied: beautifulsoup4==4.10.0 in ./myvirtualenv-copy/lib/python3.9/site-packages (from -r requirements.txt (line 1)) (4.10.0)\n",
1421-
"Requirement already satisfied: certifi==2021.10.8 in ./myvirtualenv-copy/lib/python3.9/site-packages (from -r requirements.txt (line 2)) (2021.10.8)\n",
1422-
"Requirement already satisfied: charset-normalizer==2.0.9 in ./myvirtualenv-copy/lib/python3.9/site-packages (from -r requirements.txt (line 3)) (2.0.9)\n",
1423-
"Requirement already satisfied: idna==3.3 in ./myvirtualenv-copy/lib/python3.9/site-packages (from -r requirements.txt (line 5)) (3.3)\n",
1424-
"Requirement already satisfied: requests==2.27.0 in ./myvirtualenv-copy/lib/python3.9/site-packages (from -r requirements.txt (line 6)) (2.27.0)\n",
1425-
"Requirement already satisfied: soupsieve==2.3.1 in ./myvirtualenv-copy/lib/python3.9/site-packages (from -r requirements.txt (line 7)) (2.3.1)\n",
1426-
"Requirement already satisfied: urllib3==1.26.7 in ./myvirtualenv-copy/lib/python3.9/site-packages (from -r requirements.txt (line 8)) (1.26.7)\n",
1427-
"Installing collected packages: cowsay\n",
1428-
" Attempting uninstall: cowsay\n",
1429-
" Found existing installation: cowsay 4.0\n",
1430-
" Uninstalling cowsay-4.0:\n",
1431-
" Successfully uninstalled cowsay-4.0\n",
1419+
" Cloning https://github.com/VaasuDevanS/cowsay-python.git (to revision 767c09425d813b80d67cdebba02ce387ca2eb4e8) to ./myvirtualenv-copy/src/cowsay\n",
1420+
" Running command git clone -q https://github.com/VaasuDevanS/cowsay-python.git /Users/fangohr/git/introduction-to-python-for-computational-science-and-engineering/book/myvirtualenv-copy/src/cowsay\n",
1421+
" Running command git rev-parse -q --verify 'sha^767c09425d813b80d67cdebba02ce387ca2eb4e8'\n",
1422+
" Running command git fetch -q https://github.com/VaasuDevanS/cowsay-python.git 767c09425d813b80d67cdebba02ce387ca2eb4e8\n",
1423+
" Resolved https://github.com/VaasuDevanS/cowsay-python.git to commit 767c09425d813b80d67cdebba02ce387ca2eb4e8\n",
1424+
"Collecting beautifulsoup4==4.10.0\n",
1425+
" Using cached beautifulsoup4-4.10.0-py3-none-any.whl (97 kB)\n",
1426+
"Collecting certifi==2021.10.8\n",
1427+
" Using cached certifi-2021.10.8-py2.py3-none-any.whl (149 kB)\n",
1428+
"Collecting charset-normalizer==2.0.10\n",
1429+
" Using cached charset_normalizer-2.0.10-py3-none-any.whl (39 kB)\n",
1430+
"Collecting idna==3.3\n",
1431+
" Using cached idna-3.3-py3-none-any.whl (61 kB)\n",
1432+
"Collecting requests==2.27.0\n",
1433+
" Using cached requests-2.27.0-py2.py3-none-any.whl (63 kB)\n",
1434+
"Collecting soupsieve==2.3.1\n",
1435+
" Using cached soupsieve-2.3.1-py3-none-any.whl (37 kB)\n",
1436+
"Collecting urllib3==1.26.7\n",
1437+
" Using cached urllib3-1.26.7-py2.py3-none-any.whl (138 kB)\n",
1438+
"Installing collected packages: urllib3, soupsieve, idna, charset-normalizer, certifi, requests, cowsay, beautifulsoup4\n",
14321439
" Running setup.py develop for cowsay\n",
1433-
"Successfully installed cowsay-4.0\n",
1440+
"Successfully installed beautifulsoup4-4.10.0 certifi-2021.10.8 charset-normalizer-2.0.10 cowsay-4.0 idna-3.3 requests-2.27.0 soupsieve-2.3.1 urllib3-1.26.7\n",
14341441
"\u001b[33mWARNING: You are using pip version 21.2.3; however, version 21.3.1 is available.\n",
14351442
"You should consider upgrading via the '/Users/fangohr/git/introduction-to-python-for-computational-science-and-engineering/book/myvirtualenv-copy/bin/python -m pip install --upgrade pip' command.\u001b[0m\n"
14361443
]
@@ -1673,4 +1680,4 @@
16731680
},
16741681
"nbformat": 4,
16751682
"nbformat_minor": 5
1676-
}
1683+
}

0 commit comments

Comments
 (0)