Python labs: the short version
The steps for starting a lab, getting one from GitHub, coming back to it, and handing in your work, all in one place.
This page collects the steps from the Python tutorials and the GitHub guide, for when you have done them once and just need a reminder. They explain each step: 000 sets up your computer, 010 makes a lab folder from scratch, and Getting and handing in work with GitHub covers GitHub.
How a lab folder is organized
Every lab lives in its own folder inside your CSCI295 folder:
CSCI295/
week01_first_steps/ a lab (open this folder in VS Code)
notebooks/ your notebooks (.ipynb)
data/
raw/ data you start from (never edit these files)
processed/ data you make from raw data
outputs/ figures and tables you make
pyproject.toml, uv.lock a record of the lab's Python and packages
.venv/ the lab's own Python and packages (made by uv)
- Open the lab’s folder itself in VS Code (File › Open Folder…), never the whole CSCI295 folder.
- In a notebook, name the folders at the top, relative to the notebooks folder:
from pathlib import Path
DATA_RAW = Path("../data/raw")
DATA_PROCESSED = Path("../data/processed")
OUTPUTS = Path("../outputs")Starting a lab from scratch
You will mostly get labs from GitHub, but here is how to start one yourself.
- Make the folder and open it in VS Code:
mkdir ~/CSCI295/my_lab, then File › Open Folder…. - In a new terminal (Terminal › New Terminal), set up Python and the notebook package:
uv init --bare --python 3.14 --pin-python
uv add ipykernel- Add any other packages the lab needs, for example
uv add pandas matplotlib seaborn scipy. - Make the folders. On a Mac:
mkdir -p notebooks data/raw data/processed outputs. On Windows:New-Item -ItemType Directory notebooks, data/raw, data/processed, outputs. - Make a notebook in notebooks and choose the .venv kernel (Select Kernel › Python Environments… › the environment whose path is .venv/bin/python, called .venv or named after the lab).
Getting a lab from GitHub
- Open the assignment link from the schedule and click Accept assignment. Then click Open repository and copy its URL from the green Code button.
- In VS Code, open the Command Palette (command + shift + P on a Mac, Ctrl + Shift + P on Windows), choose Git: Clone, and paste the URL. Choose your CSCI295 folder (Select as Repository Destination), and click Open.
- In a new terminal, run
uv syncto install the lab’s Python and packages. - Make your notebook in notebooks and choose the .venv kernel.
Coming back to a lab
You set up a lab once. When you come back to it:
- Open VS Code. It usually reopens the lab folder you had open last. For another lab, use File › Open Recent.
- Open your notebook and check that its kernel is .venv.
- Click Run All. The kernel forgets everything when VS Code closes, so your cells need to run again.
- For a lab from GitHub, sync before you start: click the circular arrows next to main in the status bar at the bottom of the window.
Handing in your work
- In the notebook toolbar, click Restart and then Run All. Check that it runs from top to bottom and that the results are what you expect, and save. (If it stops at an error you made on purpose, turn that line into a comment.)
- Open the Source Control panel with control + shift + G (Ctrl + Shift + G on Windows), type a message saying what you did, and click Commit.
- Click Sync Changes to push your commits to GitHub.
- Reload your repository’s page on GitHub and check that your commit is there.
We look at the last version you pushed to GitHub before the deadline on the schedule. Commit and push often.