Skip to content

Commit

Permalink
Merge pull request #354 from UBC-DSCI/main
Browse files Browse the repository at this point in the history
Update public website
  • Loading branch information
trevorcampbell authored Aug 21, 2024
2 parents 4bf8838 + e1d0b34 commit 3415c29
Show file tree
Hide file tree
Showing 11 changed files with 108 additions and 47 deletions.
36 changes: 0 additions & 36 deletions .github/workflows/build_book.yml

This file was deleted.

12 changes: 12 additions & 0 deletions .github/workflows/deploy_main_preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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/[email protected]
Expand Down
38 changes: 37 additions & 1 deletion .github/workflows/deploy_pr_preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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/[email protected]
Expand All @@ -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/[email protected]
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/[email protected]
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)
41 changes: 41 additions & 0 deletions .github/workflows/update_book.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
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
1 change: 1 addition & 0 deletions build_html.sh
Original file line number Diff line number Diff line change
@@ -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"

2 changes: 1 addition & 1 deletion source/_config.yml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion source/acknowledgements.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
Binary file modified source/img/frontmatter/ds-a-first-intro-cover.jpg
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 12 additions & 4 deletions source/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

<img src="img/frontmatter/ds-a-first-intro-cover.jpg" width="400">

<img src="https://i.creativecommons.org/l/by-nc-sa/4.0/88x31.png">

Expand Down
5 changes: 2 additions & 3 deletions source/version-control.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion source/viz.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 3415c29

Please sign in to comment.