Skip to content

Update public website #354

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 21 commits into from
Aug 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
553c6d3
Replace broken link to altair docs (#344)
lheagy Mar 23, 2024
fcc253c
Update build_book.yml
trevorcampbell Aug 18, 2024
b25f234
empty commit to trigger dev rebuild
trevorcampbell Aug 18, 2024
afee7ea
empty commit to trigger rebuild dev
trevorcampbell Aug 18, 2024
9b81640
add diffs to pr_deploy
trevorcampbell Aug 18, 2024
506fcd5
add workspace ownership reset after book build
trevorcampbell Aug 18, 2024
4d5257a
add workspace ownership reset after main deploy
trevorcampbell Aug 18, 2024
1f7af84
add workspace ownership reset after book build
trevorcampbell Aug 18, 2024
71cd66c
add pip update to pr deploy for maturin
trevorcampbell Aug 18, 2024
09b357c
fix vc ref links
trevorcampbell Aug 18, 2024
85272bd
Merge pull request #350 from UBC-DSCI/fix-vc-links-3
trevorcampbell Aug 21, 2024
2dba63e
avoid rebuilding on push to production; just copy from dev
trevorcampbell Aug 21, 2024
8e31f32
update so that gh-pages is still orphaned properly
trevorcampbell Aug 21, 2024
b0d2777
Merge pull request #352 from UBC-DSCI/no-rebuild-on-prod
trevorcampbell Aug 21, 2024
7332ac7
title page / name / image / link updates
trevorcampbell Aug 21, 2024
d5b5d99
remove existing diff folder in deploy preview
trevorcampbell Aug 21, 2024
3e2fe1d
Merge branch 'main' into title-page-updates-2024
trevorcampbell Aug 21, 2024
224ae15
list syntax markdown fix
trevorcampbell Aug 21, 2024
912a806
shrink image
trevorcampbell Aug 21, 2024
7454255
fixing spacing issues
trevorcampbell Aug 21, 2024
e1d0b34
Merge pull request #353 from UBC-DSCI/title-page-updates-2024
trevorcampbell Aug 21, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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/actions-gh-pages@v3.8.0
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/actions-gh-pages@v3.8.0
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/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)
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/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
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
Loading