Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Snow Day

Modeling Macroeconomics | Lecture 02

Johns Hopkins University

Learning Objectives

By the end of this session, students will be able to:

  1. Pull upstream changes and sync their local project

  2. Fork the course repository to preserve personal changes

  3. Navigate the updated course website and its interactive notebooks

  4. Use Jupyter notebooks for computational work

  5. Preview the course site locally

  6. Understand DataCamp assignment expectations and workflow

Part 1: Syncing Your Repository

The course repository is maintained by the instructor. When you pull changes, you are downloading the latest course materials, including new lectures, notebooks, and updated dependencies.

Pull Changes

In GitHub Desktop, click Fetch origin and then Pull origin to download the latest updates.

From the command line:

cd ~/github/moma
git pull

Sync Dependencies

After pulling, sync your environment to install any new packages:

uv sync

This ensures your local environment matches the project’s updated pyproject.toml. This week, the updated dependencies include jupytext (for opening Markdown files as notebooks) and jupyterlab-myst (for rendering MyST Markdown in JupyterLab).

Forking for Your Own Work

Part 2: Course Website Updates

The course website at jhu-econ.github.io/moma has been updated with new content, including interactive notebooks that run directly in the browser.

Interactive Notebooks

Several pages on the course website now include executable code cells powered by MyBinder. MyBinder provides free cloud computing resources so you can run Python code without installing anything on your machine.

To launch a notebook interactively, click the power button at the top of any notebook page on the website. MyBinder builds a temporary environment with all the necessary packages and lets you execute and modify code cells directly in the browser.

Previewing the Site Locally

You can preview the full course website on your own machine:

uv run myst start

This launches a local development server. Open the URL shown in the terminal (typically http://localhost:3000) to browse the site. Changes to .md files will update in real time.

Part 3: JupyterLab and Interactive Notebooks

Now that we have seen the notebooks rendered on the website, we will open them locally in JupyterLab.

Launching JupyterLab

From your ~/github/moma directory:

uv run jupyter lab

Opening Markdown Files as Notebooks

In the JupyterLab file browser, navigate to quantecon/foundations/ and click on one of the .md files (for example, numpy.md). It opens as a plain text file — just a flat Markdown document.

Now, right-click the same file and select Open With > Notebook. The file opens as an interactive Jupyter notebook. This works because jupytext (added as a project dependency and installed via uv sync) recognizes the notebook metadata embedded in these Markdown files. MyST directives like admonitions and math blocks render properly thanks to jupyterlab-myst.

Once open as a notebook, you can:

Using Notebooks in VS Code

You can also work with notebooks directly in VS Code:

  1. Open VS Code in your moma folder

  2. Create a new file with the .ipynb extension

  3. Select the Python kernel when prompted

  4. Use Shift+Enter to run a cell and advance to the next one

Part 4: DataCamp Assignments

We will walk through the DataCamp platform and discuss expectations for the interactive Python assignments.

Reading Assignment

Homework