diff --git a/.github/workflows/build_book.yml b/.github/workflows/build_book.yml
deleted file mode 100644
index 9723cd7a..00000000
--- a/.github/workflows/build_book.yml
+++ /dev/null
@@ -1,36 +0,0 @@
-name: Rebuild and deploy book to gh-pages branch
-on:
- push:
- branches:
- - production
- paths:
- - 'source/**'
- - 'build_html.sh'
-
-jobs:
- deploy-book:
- runs-on: ubuntu-latest
- permissions:
- contents: write
- packages: write
-
- steps:
- - name: checkout
- uses: actions/checkout@v2
- with:
- ref: 'production'
-
- - name: Build the book
- run: |
- ./build_html.sh
-
- # Push the book's HTML to github-pages
- - name: GitHub Pages action
- uses: peaceiris/actions-gh-pages@v3.8.0
- with:
- github_token: ${{ secrets.GITHUB_TOKEN }}
- publish_dir: source/_build/html
- cname: python.datasciencebook.ca
- force_orphan: true # this will clean up all previous PR previews / main branch preview
-
-
diff --git a/.github/workflows/deploy_main_preview.yml b/.github/workflows/deploy_main_preview.yml
index 8b65ea7b..0b3aaf50 100644
--- a/.github/workflows/deploy_main_preview.yml
+++ b/.github/workflows/deploy_main_preview.yml
@@ -15,6 +15,13 @@ jobs:
packages: write
steps:
+ - name: Get Actions user id
+ id: get_uid
+ run: |
+ actions_user_id=`id -u $USER`
+ echo $actions_user_id
+ echo "uid=$actions_user_id" >> $GITHUB_OUTPUT
+
- name: checkout
uses: actions/checkout@v2
with:
@@ -24,6 +31,11 @@ jobs:
run: |
./build_html.sh
+ - name: Reset ownership of workspace after build
+ uses: peter-murray/reset-workspace-ownership-action@v1
+ with:
+ user_id: ${{ steps.get_uid.outputs.uid }}
+
# Push the book's HTML to github-pages
- name: GitHub Pages action
uses: peaceiris/actions-gh-pages@v3.8.0
diff --git a/.github/workflows/deploy_pr_preview.yml b/.github/workflows/deploy_pr_preview.yml
index ec2fb38d..d4cc2ef0 100644
--- a/.github/workflows/deploy_pr_preview.yml
+++ b/.github/workflows/deploy_pr_preview.yml
@@ -23,7 +23,14 @@ jobs:
checkName: "Rebuild docker image"
ref: ${{ github.event.pull_request.head.sha }}
timeoutSeconds: 60000
-
+
+ - name: Get Actions user id
+ id: get_uid
+ run: |
+ actions_user_id=`id -u $USER`
+ echo $actions_user_id
+ echo "uid=$actions_user_id" >> $GITHUB_OUTPUT
+
- name: Checkout the repo
uses: actions/checkout@v2
with:
@@ -34,6 +41,11 @@ jobs:
run: |
./build_html.sh
+ - name: Reset ownership of workspace after build
+ uses: peter-murray/reset-workspace-ownership-action@v1
+ with:
+ user_id: ${{ steps.get_uid.outputs.uid }}
+
# Push the book's HTML to github-pages
- name: GitHub Pages action
uses: peaceiris/actions-gh-pages@v3.8.0
@@ -44,11 +56,35 @@ jobs:
destination_dir: pull${{ github.event.number }}
# force_orphan: true # once peaceiris updates to v4, change this to true and keep_files: true for the PR / main branch deploy previews
+ - name: Checkout the gh-pages branch
+ uses: actions/checkout@v2
+ with:
+ fetch-depth: '0'
+ ref: 'gh-pages'
+
+ - name: Run website diff
+ run: |
+ rustup update
+ pip install --upgrade pip
+ pip install website_diff
+ rm -rf diff${{ github.event.number }}
+ website_diff --old dev --new pull${{ github.event.number }} --diff diff${{ github.event.number }}
+
+ - name: GitHub Pages action to push diff
+ uses: peaceiris/actions-gh-pages@v3.8.0
+ with:
+ github_token: ${{ secrets.GITHUB_TOKEN }}
+ publish_dir: diff${{ github.event.number }}
+ keep_files: true
+ destination_dir: diff${{ github.event.number }}
+ # force_orphan: true # once peaceiris updates to v4, change this to true and keep_files: true for the PR / main branch deploy previews
+
- name: Post URLS to PR thread
uses: mshick/add-pr-comment@v2.8.1
with:
message: |
Hello! I've built a preview of your PR so that you can compare it to the current `main` branch.
* PR deploy preview available [here](https://python.datasciencebook.ca/pull${{ github.event.number }}/index.html)
+ * PR diff with `main` available [here](https://python.datasciencebook.ca/diff${{ github.event.number }}/index.html)
* Current `main` deploy preview available [here](https://python.datasciencebook.ca/dev/index.html)
* Public production build available [here](https://python.datasciencebook.ca)
diff --git a/.github/workflows/update_book.yml b/.github/workflows/update_book.yml
new file mode 100644
index 00000000..c9ff635f
--- /dev/null
+++ b/.github/workflows/update_book.yml
@@ -0,0 +1,41 @@
+name: Rebuild and deploy book to gh-pages branch
+on:
+ push:
+ branches:
+ - production
+ paths:
+ - 'source/**'
+ - 'build_html.sh'
+
+jobs:
+ deploy-book:
+ runs-on: ubuntu-latest
+ permissions:
+ contents: write
+ packages: write
+
+ steps:
+ - name: checkout gh-pages
+ uses: actions/checkout@v2
+ with:
+ ref: 'gh-pages'
+
+ - name: Copy contents of dev/ to home folder
+ run: |
+ yes | cp -rf dev ${{ runner.home }}
+
+ # Push update website to dev/ and clean out old commits
+ - name: Update website to contents of dev, remove all old commits and subpages
+ uses: peaceiris/actions-gh-pages@v3.8.0
+ with:
+ github_token: ${{ secrets.GITHUB_TOKEN }}
+ publish_dir: dev/
+ force_orphan: true # this will clean up all previous PR previews / main branch preview
+ cname: datasciencebook.ca
+
+ - name: copy dev/ website back in
+ run: |
+ yes | cp -rf ${{ runner.home }}/dev dev
+
+ - name: push the result to gh-pages
+ uses: stefanzweifel/git-auto-commit-action@v5
diff --git a/build_html.sh b/build_html.sh
index 41797e19..8694a2b2 100755
--- a/build_html.sh
+++ b/build_html.sh
@@ -1,2 +1,3 @@
chmod -R o+w source/
docker run --rm -v $(pwd):/home/jovyan ubcdsci/py-intro-to-ds:20231112004031dd2207 /bin/bash -c "jupyter-book build source"
+
diff --git a/source/_config.yml b/source/_config.yml
index 22b14de3..11b75592 100755
--- a/source/_config.yml
+++ b/source/_config.yml
@@ -1,5 +1,5 @@
# Book settings
-title: "Data Science: A First Introduction (Python Edition)"
+title: "Data Science: A First Introduction with Python"
author: "Tiffany Timbers, Trevor Campbell, Melissa Lee, Joel Ostblom, and Lindsey Heagy"
copyright: "2022" # Copyright year to be placed in the footer
logo: "" # A path to the book logo
diff --git a/source/acknowledgements.md b/source/acknowledgements.md
index 3b08d251..b2b1b3ac 100755
--- a/source/acknowledgements.md
+++ b/source/acknowledgements.md
@@ -50,7 +50,7 @@ is reflected in the content of this book.
## Acknowledgments for the Python Edition
We'd like to thank everyone that has contributed to the development of
-[*Data Science: A First Introduction (Python Edition)*](https://python.datasciencebook.ca).
+[*Data Science: A First Introduction with Python*](https://python.datasciencebook.ca).
This is an open source Python translation of the original
book, which focused on the R programming language. Both of these books are
used to teach DSCI 100 at the University of British Columbia (UBC).
diff --git a/source/img/frontmatter/ds-a-first-intro-cover.jpg b/source/img/frontmatter/ds-a-first-intro-cover.jpg
old mode 100755
new mode 100644
index 22629021..b3fa4065
Binary files a/source/img/frontmatter/ds-a-first-intro-cover.jpg and b/source/img/frontmatter/ds-a-first-intro-cover.jpg differ
diff --git a/source/index.md b/source/index.md
index 454fa914..71d910ac 100755
--- a/source/index.md
+++ b/source/index.md
@@ -17,19 +17,27 @@ kernelspec:
# Data Science
-## *A First Introduction (Python Edition)*
+## *A First Introduction with Python*
*Tiffany Timbers, Trevor Campbell, Melissa Lee, Joel Ostblom, Lindsey Heagy*
### Welcome!
-This is the [website](https://python.datasciencebook.ca) for *Data Science: A First Introduction (Python Edition)*.
+This is the [website](https://python.datasciencebook.ca) for *Data Science: A First Introduction with Python*.
You can read the web version of the book on this site. Click a section in the table of contents
on the left side of the page to navigate to it. If you are on a mobile device,
you may need to open the table of contents first by clicking the menu button on
-the top left of the page.
+the top left of the page. You can purchase a PDF or print copy of the book on the [CRC Press website](https://www.routledge.com/Data-Science-A-First-Introduction-with-Python/Timbers-Campbell-Lee-Ostblom-Heagy/p/book/9781032572239) or on [Amazon](https://www.amazon.com/Data-Science-Introduction-Python-Chapman/dp/103257223X).
-For the R version of the textbook, please visit https://datasciencebook.ca.
+For the R version of the textbook, please visit [https://datasciencebook.ca](https://datasciencebook.ca).
+
+This book is listed in a number of open educational resource (OER) collections:
+
+- [The University of British Columbia OER collection](https://oer.open.ubc.ca/data-science-a-first-introduction-python-version/)
+- [The OER Commons](https://oercommons.org/courses/data-science-a-first-introduction-with-python)
+- [MERLOT](https://merlot.org/merlot/viewMaterial.htm?id=773420157)
+
+
diff --git a/source/version-control.md b/source/version-control.md
index 48c49026..9d74b7e6 100755
--- a/source/version-control.md
+++ b/source/version-control.md
@@ -1113,9 +1113,8 @@ and guidance that the worksheets provide will function as intended.
Now that you've picked up the basics of version control with Git and GitHub,
you can expand your knowledge through the resources listed below:
-- GitHub's [guides website](https://guides.github.com/) and [YouTube
- channel](https://www.youtube.com/githubguides) are great resources to take the next steps in
- learning about Git and GitHub.
+- GitHub's [guides website](https://docs.github.com/) is a great resource for
+ learning more about Git and GitHub.
- [Good enough practices in scientific
computing](https://journals.plos.org/ploscompbiol/article?id=10.1371/journal.pcbi.1005510#sec014)
{cite:p}`wilson2014best` provides more advice on useful workflows and "good enough"
diff --git a/source/viz.md b/source/viz.md
index e062a679..97ba2020 100755
--- a/source/viz.md
+++ b/source/viz.md
@@ -1549,7 +1549,7 @@ To fix this issue we can convert the `Expt` variable into a `nominal`
to the `Expt` variable. Adding the `:N` suffix ensures that `altair`
will treat a variable as a categorical variable, and
hence use a discrete color map in visualizations
-([read more about data types in the altair documentation](https://altair-viz.github.io/user_guide/encoding.html#encoding-data-types)).
+([read more about data types in the altair documentation](https://altair-viz.github.io/user_guide/encodings/index.html#encoding-data-types)).
We also add the `stack(False)` method on the `y` encoding so
that the bars are not stacked on top of each other,
but instead share the same baseline.