A hands-on introduction to Python from NC State University Libraries' Data Science Services, first taught at the
Data Science Training Intensive. Attendees install Python and JupyterLab on their own laptop with
uv (or conda, if they already use it), then work there: variables, data types, lists and
dictionaries, operators, if, for, methods, and a function of their own. Google Colab is the backup when an install
gets stuck.
Workshop site: https://ncsu-libraries.github.io/dsti-python/
| Notebook | Open it |
|---|---|
| Learner: blank code cells you fill in with the instructor | |
| Filled: every exercise answered, to check your work |
To work on your laptop, follow the site's Setup page: it downloads the notebook and opens it in JupyterLab. In Colab, click Copy to Drive so your changes are saved to your own Google Drive.
The notebooks condense the Basics and Loops and Functions workshops from
Getting Started with Python. The full workshops cover
everything skipped here: dates and times, type conversion, while loops, and reading and writing files.
| Path | What it is |
|---|---|
notebooks/ |
The session's learner and filled notebooks, generated by tools/build_notebooks.py, and the follow-along activities' notebooks, generated by tools/build_activities.py |
data/ |
The activities' data files, served from the site for download |
site/ |
The Quarto website: start page, setup guide, cheat sheet, and the slide deck (site/slides/) |
tools/ |
The notebook builders (build_notebooks.py, build_activities.py with one module per activity in tools/activities/), atus_data.py for the time-use data, the post-render step that copies notebooks and data into the site, a link checker, a screenshot script, and the setup video's recorder (record-tour.mjs, tour/) |
You need Quarto 1.10 or later. RStudio ships one at
/Applications/RStudio.app/Contents/Resources/app/quarto/bin/quarto.
quarto render site # builds site/_site, including the deck; post-render copies notebooks/ into it
quarto preview site # or serve it locally while editing
python3 tools/check_links.py [--web] # checks every link and image in site/_site; --web also requests external URLsThe notebooks are built from a pinned commit (9b288fa) of
getting-started-with-python. With that repository
checked out locally:
python3 tools/build_notebooks.py --src ~/Desktop/getting-started-with-pythonChange the notebooks by editing the manifest in tools/build_notebooks.py and running it again. Hand edits to the
.ipynb files are overwritten on the next build.
The activity notebooks come from one module per activity in tools/activities/, and their data from data/:
python3 tools/build_activities.py # regenerate the activity notebooks; --check fails if any is stale
python3 tools/atus_data.py # rebuild data/atus_*.csv from the DSTI team's shared drive
node tools/record-tour.mjs # re-record the Setup page's video (needs Google Chrome and ffmpeg)Pushing to main runs .github/workflows/deploy-pages.yml, which renders the site and deploys it to GitHub Pages. Set
Settings → Pages → Source to GitHub Actions before the first push, or the first deploy fails; if it did,
re-run the workflow from the Actions tab. Changes to notebooks/ redeploy too, because the site serves the
notebooks for download. The Colab links work once the repository is public on GitHub.
If the site moves to a different GitHub owner or repo name, search for ncsu-libraries.github.io and
NCSU-Libraries/dsti-python and change both, then point the go link in site/_variables.yml at the new
address and regenerate its QR code (site/images/qr-session.svg).
Content is licensed CC BY 4.0 and code is MIT. The notebooks adapt material from Getting Started with Python (CC BY 4.0) by Alp Tezbasaran, with credit to Selene R. Schmittling.
The time-use activity's data (data/atus_*.csv) is an extract of the American Time Use Survey (U.S. Bureau of Labor
Statistics), via ICPSR study 36268, sampled and prepared by the Data Science Training Intensive team.
The café activity's data (data/cafe_sales.csv) is synthetic, from the Libraries' Agentic Coding with Claude workshop
(CC BY 4.0).