Chapter 1 Demo Chapter

Here’s some code that’ll run in a notebook and also run in CI.

print("Hello world")

1.1 How to Use the Setup

You can write chapters for the course using standard markdown files in a variety of ways. Here are a few approaches that we’ve found useful. Before getting started, you need to set up a Python environment and install the Python requirements. Once you have Python set up, run pip install -r requirements.txt from the root directory to install all the requirements.

If you want to use the interactive approach described below, you’ll also need to run jupyter server extension enable jupytext to enable jupytext.

1.1.1 The Bare-Bones Approach

  1. Use a text editor of your choice to modify the markdown. Any fenced code block starting with the python language identifier will be executed when you convert the markdown to html.
  2. Run make [your markdown document].ipynb.html from the command line to execute the notebook and convert it to html.

1.1.2 The Interactive Approach

Recompiling the document with make every time you make a small change can be cumbersome. You can get an interactive environment using Jupyter Lab.

  1. Run jupyter lab from the command line to start a new Jupyter Lab server.
  2. Once the server has loaded (it can take a few seconds), right-click on the markdown file you want to modify, hover your mouse over “Open With”, and select “Notebook”. If you don’t see the “Notebook” option, shut down the server, execute jupyter server extension enable jupytext, then restart the server.
  3. Make any changes in the notebook. You can execute code interactively. Hit save, and the markdown document will be updated.
  4. Once your happy with the document, make sure to run make [your markdown document].ipynb.html from the command line to verify your changes work as expected.

1.1.3 Adding Google Slide Images

To add an image from a Google Slide deck, use the following markdown syntax.

![alternative if the image is broken](https://docs.google.com/presentation/d/<presentation identifier>/export/png?pageid=<slide identifier without the .id prefix>)

Here is an example.

Data Science Process

{r, include = FALSE} ottrpal::set_knitr_image_path()