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.

Portfolio site, continued

You’ll be given a bunch of instructions without (fully) understanding what they do yet. That’s ok. We get more into these topics in Lecture 17 and Advanced Computing for Policy.

  • We’re building on the prep from Lecture 16.

  • The instructions are very specific, follow them closely.

  • Whenever you’re told to create a file, it should be in the “root” of your repository (the [username].github.io folder).

Git

Git setup

[once per computer]

  1. Ensure you’ve installed Git.

  2. Open your [username].github.io folder in VSCode.

  3. Open the terminal.

  4. Set global name and email in Git.

    • Your name and email can be set to whatever.

Local repository setup

[once per working folder]

  1. In sidebar, click Source Control.

  2. Initialize Repository

  3. You should see a bunch of files under Changes.

gitignore

  1. Create a .gitignore file containing the following: [once per repository]

    .DS_Store
    .ipynb_checkpoints/
    _build/
    
    # make sure Labs aren't included
    Lab*.ipynb
    lab*.ipynb
    
    # virtual environments; not needed in Python 3.13+, as a .gitignore is added to that folder
    # https://docs.python.org/3/library/venv.html#cmdoption-venv-without-scm-ignore-files
    .venv/
    myenv/
  2. You should now see only the following under Changes:

    • .gitignore

    • lecture_16_example.ipynb

    • requirements.txt

Commit

  • Use a meaningful commit message, like “adding example notebook and gitignore”.

  • If it asks about There are no staged changes, click Always.

Make changes

  1. In lecture_16_example.ipynb, add a Markdown cell at the top with a heading (level 1).

    # Lecture 16 Example
  2. Commit.

  3. Your Source Control Graph (a.k.a. your Git history) should then look something like this:

    Git history

GitHub

If you miss a step, don’t worry - it’s possible to do them out of order. Ask for help if you need.

  1. Click Publish Branch.

  2. Allow signing in with GitHub, if prompted. [once per computer]

  3. Click Publish to GitHub public repository. [once per repository]

  4. Have VSCode periodically fetch, if asked.

  5. Visit the repository on GitHub.

    1. Click into the files.

Make changes

  1. In VSCode, add an index.md file with the following. (You can expand it later.)

    # [Your name]'s Portfolio
    
    Welcome! Work in progress.
  2. Commit.

  3. Push (a.k.a. “sync”) the change to GitHub.

View

Open the repository on GitHub, which should look something like this:

repository file list

Jupyter Book

Install

Add this to your requirements.txt:

jupyter-book==2.*

then install the packages.

Initialize the site

Open the integrated terminal and run:

jupyter book init --write-toc

Push to GitHub

  1. View the diff

  2. Commit

  3. Push

  4. The GitHub repository should then look like this:

    repository with Jupyter Book files

Deploy the site

To make your site visible to others, deploy to GitHub pages.

Check the site: https://[username].github.io

You are more than welcome to customize the site as much as you like, but make sure you finish the assigned work first.