Skip to content

stanfordjournalism/first-python-notebook

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

first-python-notebook

Starter template for the First Python Notebook tutorial and assignment.

IMPORTANT: We'll be using a different coding workflow than the one used in the official tutorial. Therefore, please follow the setup instructions below and, once complete, begin your work with Chapter 3 - pandas.

Getting started

The below instructions are for working in GitHub Codespaces with Jupyter and the uv package management tool. See this screencast on Jupyter and Codespaces and others in this YouTube series for help on various aspects of working in this context.

To set up your coding environment on Codespaces for this assignment, follow these steps:

  • Go to the GitHub repository page for this assignment
  • Click the green Code button and open a GitHub Codespace
  • Once the Codespace is running, go to the Extensions area in the left side navigation and install the Python and Jupyter extensions
  • Open a Terminal shell and run the following commands (one at a time) in the shell. Hit return/enter after each of the below commands:
    • pipx install uv
    • uv init
    • uv add jupyter ipykernel pandas altair
  • Using the File menu, create a new Jupyter notebook called first_python_notebook.ipynb
  • In the upper right of the notebook, click Select kernel, then choose Python environments and select the kernel/environment that is tied to your "uv" environment. Typically this should be named after the repo plus your GH username and has a .venv/bin/python path at the end. The environment may also be starred as the recommended choice.
  • Test your setup by creating a code cell in the notebook, typing import pandas as pd, and hit the play button to the left of the cell (or shift + enter). If you see a green check mark, you should be good to go. If not, reach out to an instructor for help debugging.

Saving and submitting code.

Remember that in Codespaces, you must commit (aka save) and push your work back to GitHub so that your instructors can view the code. Watch this video if you need a refresher on saving and submitting your work.

IMPORTANT: You should regularly save and push your work, even if it is not completed. That way you avoid losing work if something goes wrong with the Codespace (it happens). And you should definitely always save your work before exiting out of the Codespace, again, even if the work is not yet complete.

About

Starter template for First Python Notebook assignment

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published