Skip to content

Commit 9e4760d

Browse files
committed
Merge branch 'master' into review-next-steps
2 parents 1a534a4 + a74e2a5 commit 9e4760d

24 files changed

+1960
-24952
lines changed

.github/workflows/deploy.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ on:
55
types: [created]
66
push:
77
# all
8+
workflow_dispatch:
89

910
jobs:
1011
docker-build-and-deploy:
@@ -54,7 +55,7 @@ jobs:
5455
5556
# Deploy the book's HTML to gh-pages branch
5657
- name: GitHub Pages action
57-
uses: peaceiris/actions-gh-pages@bbdfb200618d235585ad98e965f4aafc39b4c501
58+
uses: peaceiris/actions-gh-pages@v3
5859
with:
5960
github_token: ${{ secrets.GITHUB_TOKEN }}
6061
publish_dir: ./book/_build/html

.github/workflows/nbval.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: nbval
2+
3+
on:
4+
push:
5+
# all
6+
workflow_dispatch:
7+
8+
jobs:
9+
docker-build-and-nbval:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v2
13+
14+
- name: Set up Docker Buildx
15+
uses: docker/setup-buildx-action@v1
16+
17+
- name: Cache Docker layers
18+
uses: actions/cache@v2
19+
with:
20+
path: /tmp/.buildx-cache
21+
key: ${{ runner.os }}-buildx-${{ hashFiles('poetry.lock') }}
22+
restore-keys: |
23+
${{ runner.os }}-buildx-${{ hashFiles('poetry.lock') }}
24+
25+
# This build and push step does the same thing as `make docker-build`, but
26+
# makes it easier to store and load caches, which is why we use it instead
27+
- name: Build and Save Layers Locally
28+
uses: docker/build-push-action@v2
29+
with:
30+
context: ./
31+
file: ./Dockerfile
32+
load: true
33+
cache-from: type=local,src=/tmp/.buildx-cache
34+
cache-to: type=local,dest=/tmp/.buildx-cache
35+
tags: python4compscience
36+
37+
- name: List Available Images
38+
run: docker images
39+
40+
- name: Run NBVAL over all chapters
41+
run: make docker-nbval

.github/workflows/stage.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ name: Book Staging
33
on:
44
pull_request:
55
branches: [ master ]
6+
workflow_dispatch:
67

78
jobs:
89
docker-build-and-stage:

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,4 @@ stock.csv
2222
.venv
2323
.venv/
2424
book/_build
25+
.DS_Store

Dockerfile

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,26 @@
1-
FROM debian:bullseye-slim
1+
FROM debian:bookworm-slim
22

3-
RUN apt-get update -y && apt-get install -y texlive-xetex latexmk texlive-xetex \
4-
texlive-fonts-extra fonts-freefont-otf python3 python3-pip git zile
3+
#RUN apt-get update -y && apt-get install -y texlive-xetex latexmk texlive-xetex \
4+
# texlive-fonts-extra fonts-freefont-otf python3 python3-pip git zile wget
55

6-
COPY poetry.lock pyproject.toml /opt/
6+
RUN apt-get update -y && apt-get install -y python3 python3-pip texlive-xetex \
7+
latexmk git zile wget texlive-fonts-extra python3-venv
78

8-
RUN pip install poetry==1.1.4
9+
COPY requirements.txt /opt/
910

1011
WORKDIR /opt/
11-
RUN poetry config virtualenvs.create false
12-
RUN poetry install -vvv
12+
RUN python3 -m venv venv
13+
RUN . venv/bin/activate && pip install -r requirements.txt
14+
RUN . venv/bin/activate && pip list
15+
# activate venv
16+
ENV PATH="/opt/venv/bin:$PATH"
1317

1418
RUN mkdir -p /io
1519
WORKDIR /io
1620

1721
# Need this for one nbval and chapter 1
1822
RUN ln -s /usr/bin/python3 /usr/local/bin/python
1923

24+
# supress warning when running jupyter-book in container
25+
ENV PYDEVD_DISABLE_FILE_VALIDATION=1
2026
CMD ["/bin/bash"]

Makefile

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ all:
33
make pdf
44

55
install:
6-
poetry install -vvv
6+
pip install -r requirements.txt
77

88
clean:
99
cd book; rm -rf \
@@ -13,16 +13,21 @@ clean:
1313
_build .ipynb_checkpoints
1414

1515
html:
16-
poetry run jupyter-book build book --builder html
16+
jupyter-book build book --builder html
1717

1818
linkcheck:
19-
poetry run jupyter-book build book --builder linkcheck
19+
jupyter-book build book --builder linkcheck
2020

2121
pdf: book/*-*.ipynb
22-
poetry run jupyter-book build book --builder pdflatex
22+
jupyter-book build book --builder pdflatex
2323

2424
nbval:
25-
poetry run pytest -v --nbval book/*.ipynb --sanitize-with book/static/nbval_sanitize.cfg
25+
@echo "Testing all chapters (apart from 18) with --nbval"
26+
pytest -v --nbval book --sanitize-with book/static/nbval_sanitize.cfg \
27+
--ignore=book/18-environments.ipynb --ignore=book/_build
28+
@echo "Testing chapter 18 with --nbval-lax"
29+
pytest -v --nbval-lax book/18-environments.ipynb
30+
2631

2732

2833
docker-all:
@@ -39,16 +44,8 @@ docker-build:
3944
docker-build-nocache:
4045
docker build -t python4compscience2 --no-cache .
4146

42-
# Here we only bind the required directories and files into the docker container
43-
# at runtime to avoid potential conflicts with local files
44-
4547
define DOCKER_RUN
46-
docker run --workdir=/io \
47-
-v $(CURDIR)/book:/io/book \
48-
-v $(CURDIR)/Makefile:/io/Makefile \
49-
-v $(CURDIR)/poetry.lock:/io/poetry.lock \
50-
-v $(CURDIR)/pyproject.toml:/io/pyproject.toml \
51-
python4compscience
48+
docker run --rm -v $(CURDIR):/io python4compscience
5249
endef
5350

5451
docker-bash:

Readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ and schools. Please send a message to the author if you do so.
119119

120120
Hans Fangohr is a researcher and teacher (see
121121
[homepage](https://fangohr.github.io), [blog](https://fangohr.github.io/blog),
122-
[twitter](https://twitter.com/ProfCompMod)). His interests include effective
122+
[mastodon](https://fosstodon.org/@ProfCompMod)). His interests include effective
123123
software engineering for computational science and data science, researching
124124
computational modelling and data analysis methods, and education. He is a
125125
Professor at the [University of Southampton (UK)](https://www.southampton.ac.uk)

book/12-symbolic-computation.ipynb

Lines changed: 22 additions & 21 deletions
Large diffs are not rendered by default.

book/14-numpy.ipynb

Lines changed: 4 additions & 6 deletions
Large diffs are not rendered by default.

book/15-visualising-data.ipynb

Lines changed: 44 additions & 13427 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)