Skip to content

Commit 1bbdafb

Browse files
Merge pull request #222 from UBC-DSCI/main
Production push pre-fall 2023
2 parents 34e0902 + 0dbc603 commit 1bbdafb

File tree

360 files changed

+2364
-2118
lines changed

Some content is hidden

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

360 files changed

+2364
-2118
lines changed

.github/workflows/build_book.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,6 @@ jobs:
3030
github_token: ${{ secrets.GITHUB_TOKEN }}
3131
publish_dir: source/_build/html
3232
force_orphan: true
33+
cname: python.datasciencebook.ca
34+
3335

.github/workflows/update_build_environment.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,15 @@ jobs:
3434
chmod u+x build_html.sh
3535
git add build_html.sh
3636
git commit -m "update build_html.sh script with new docker image"
37+
- name: Update build_pdf.sh script
38+
run: |
39+
git config --local user.email "[email protected]"
40+
git config --local user.name "GitHub Action"
41+
git pull origin main
42+
sed 's/ubcdsci\/py-intro-to-ds:[[:alnum:]]\+/ubcdsci\/py-intro-to-ds:${{ steps.rebuild.outputs.snapshot-tag }}/g' build_pdf.sh > build_pdf.tmp && mv build_pdf.tmp build_pdf.sh
43+
chmod u+x build_pdf.sh
44+
git add build_pdf.sh
45+
git commit -m "update build_pdf.sh script with new docker image"
3746
- name: Push changes to build scripts
3847
uses: ad-m/github-push-action@master
3948
with:

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ source/*.ipynb
88
source/*.py
99
*.swp
1010
*.swo
11+
source/__pycache__

Dockerfile

Lines changed: 34 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ FROM jupyter/scipy-notebook
33

44
USER root
55

6-
# install vim
7-
RUN apt-get update && apt-get install -y vim
6+
# install vim and a few packages for PDF builds
7+
RUN apt-get update && apt-get install -y vim texlive-latex-extra texlive-fonts-extra texlive-xetex latexmk xindy imagemagick
88

99
USER ${NB_UID}
1010

@@ -13,19 +13,36 @@ WORKDIR "${HOME}"
1313
# remove the "work/" directory added in an earlier layer...
1414
RUN rm -rf work
1515

16-
# Install R packages
17-
RUN mamba install --quiet --yes \
18-
'numpy' \
19-
'jinja2' \
20-
'altair_data_server' \
21-
'altair_saver' \
22-
'click' \
23-
'ibis-framework' \
24-
'ghp-import' \
25-
'jupytext' \
26-
'jupyter-book' \
27-
'nodejs' \
28-
&& mamba clean --all -f -y \
29-
&& fix-permissions "${CONDA_DIR}" \
30-
&& fix-permissions "/home/${NB_USER}"
16+
17+
RUN pip install docutils==0.17.1 # Need to pin docutils to an old version for now, due to https://github.com/executablebooks/jupyter-book/issues/2022
18+
RUN pip install referencing
19+
RUN pip install jupyter-book
20+
# Pinning pandas until altair 5.1.2 to avoid future warning https://github.com/altair-viz/altair/issues/3181
21+
RUN pip install numpy jinja2 pandas"<2.1" altair">=5.1.1" "vegafusion[embed]" vl-convert-python">=0.13" click ibis-framework ghp-import jupytext nodejs
22+
23+
# forces scikit-learn to grab latest to avoid bug in 1.3.0 related to checking for c-contiguity breaking figures in classification 2. See https://github.com/scikit-learn/scikit-learn/pull/26772
24+
# TODO: remove this once scikit-learn 1.4.x or beyond releases and is incorporated into jupyter/scipy-notebook
25+
RUN pip install -U git+https://github.com/scikit-learn/scikit-learn.git@main
26+
27+
# disable warnings that pollute build logs; seems to be related to the update to python 3.11
28+
# https://discourse.jupyter.org/t/debugger-warning-it-seems-that-frozen-modules-are-being-used-python-3-11-0/16544/12
29+
ENV PYDEVD_DISABLE_FILE_VALIDATION=1
30+
31+
## Install various python packages
32+
# commented out for now due to various package version conflicts
33+
# installing via pip instead above
34+
#RUN mamba install --quiet --yes \
35+
# 'numpy' \
36+
# 'jinja2' \
37+
# 'altair_data_server' \
38+
# 'altair_saver' \
39+
# 'click' \
40+
# 'ibis-framework' \
41+
# 'ghp-import' \
42+
# 'jupytext' \
43+
# 'jupyter-book' \
44+
# 'nodejs' \
45+
# && mamba clean --all -f -y \
46+
# && fix-permissions "${CONDA_DIR}" \
47+
# && fix-permissions "/home/${NB_USER}"
3148

README.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
## Data Science: A First Introduction (Python Edition)
22
This is the source for the python edition of the *Data Science: A First Introduction* textbook.
33

4+
The book is available online at: https://python.datasciencebook.ca/
5+
46
For the R version of the textbook, please visit https://datasciencebook.ca or the github repository
5-
at https://github.com/ubc-dsci/introduction-to-datascience .
7+
at https://github.com/ubc-dsci/introduction-to-datascience.
68

79
## License Information
810

@@ -24,12 +26,18 @@ The `production` branch contains the source material for the live, publicly view
2426

2527
### Build locally
2628

27-
You can build the book on your own machine by running
29+
You can build the HTML version of the book on your own machine by running
2830
```
2931
./build_html.sh
3032
```
3133
in the root directory of this repository. The book can be viewed in your browser by opening the `source/_build/html/index.html` file.
3234

35+
You can build the PDF version of the book on your own machine by running
36+
```
37+
./build_pdf.sh
38+
```
39+
in the root directory of this repository. The book can be viewed in a PDF reader by opening `source/_build/latex/python.pdf`.
40+
3341
### Update build environment
3442

3543
You can update the build environment for the book by making changes to `Dockerfile` in the root of the repository in the `main` branch.

build_html.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
chmod -R o+w source/
2-
docker run --rm -v $(pwd):/home/jovyan ubcdsci/py-intro-to-ds:20230104230634037f38 /bin/bash -c "jupyter-book build source"
2+
docker run --rm -v $(pwd):/home/jovyan ubcdsci/py-intro-to-ds:20230831171718ddf538 /bin/bash -c "jupyter-book build source"
3+
chmod -R o-w source/

build_pdf.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
chmod -R o+w source/
2+
docker run --rm -v $(pwd):/home/jovyan ubcdsci/py-intro-to-ds:20230831171718ddf538 /bin/bash -c "export BOOK_BUILD_TYPE='PDF'; jupyter-book build source --builder pdflatex"
3+
chmod -R o-w source/

logo.png

-9.62 KB
Binary file not shown.

preamble.tex

Lines changed: 0 additions & 11 deletions
This file was deleted.

printindex.tex

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)