UC Davis DataLab
Fall 2021
Instructors: Arthur Koehl <avkoehl@ucdavis.edu>,
Nick Ulle <naulle@ucdavis.edu>
This 4-part workshop series provides an introduction to using the Python programming language for reproducible data analysis and scientific computing. Topics include programming basics, how to work with tabular data, how to break down programming problems, and how to organize code for clarity and reproducibility.
After this workshop, learners will be able to load tabular data sets into Python, compute simple summaries and visualizations, do common data-tidying tasks, write reusable functions, and identify where to go to learn more.
TODO: Requirements
The course reader is a live webpage, hosted through GitHub, where you can enter curriculum content and post it to a public-facing site for learners.
To make alterations to the reader:
Run git pull
, or if it's your first time contributing, see the
Setup section of this document.
Edit an existing chapter file or create a new one. Chapter files are
Markdown files (.md
) in the chapters/
directory. Enter your text, code,
and other information directly into the file. Make sure your file:
##_topic-of-chapter.md
(the only exception is
index.md
, which contains the reader's front page).# This
). This will be the title
of your chapter. Subsequent section headers should be second-level
headers (like ## This
) or below.Put any supporting resources in data/
or img/
. For large files, see the
Large Files section of this document. You do not need to
add resources generated by your code (such as plots). The next step saves
these in docs/
automatically.
Run the command jupyter-book build .
in a shell at the top level of the
repo to regenerate the HTML files in the _build/
.
When you're finished, git add
:
img/
.gitattributes
file (if you added a large file)Then git commit
and git push
. This updates the main
branch of the
repo, which contains source materials for the web page (but not the web
page itself).
Run the command ghp-import -n -p -f _build/html
in a shell at the top
level of the repo to update the gh-pages
branch of the repo. This uses
the ghp-import
Python package, which you will need to
install first (pip install ghp-import
). The live web page will update
automatically after 1-10 minutes.
If you want to include a large file (say over 1 MB), you should use git LFS. You can register a large file with git LFS with the shell command:
git lfs track YOUR_FILE
This command updates the .gitattributes
file at the top level of the repo. To
make sure the change is saved, you also need to run:
git add .gitattributes
Now that your large is registered with git LFS, you can add, commit, and push the file with git the same way you would any other file, and git LFS will automatically intercede as needed.
GitHub provides 1 GB of storage and 1 GB of monthly bandwidth free per repo for large files. If your large file is more than 50 MB, check with the other contributors before adding it.
Install jupyter-book using pip
pip install -U jupyter-book
This repo uses Git Large File Storage (git LFS) for large files. If you don't have git LFS installed, download it and run the installer. Then in the shell (in any directory), run:
git lfs install
Then your one-time setup of git LFS is done. Next, clone this repo with git clone
. The large files will be downloaded automatically with the rest of the
repo.