Lecture 23: Editors and version control#
Open this web page
There are links and commands you’ll need
Start VSCode download/install
Largely live demo and installation
If everything works, it will be a miracle
Thanks for your patience
Showing the recommended+supported path
If you’re comfortable with alternatives, can use those
May feel like a whirlwind, just skimming the surface of these tools
Keeping the information in the slides minimal
There are links to more info
Note to self: can demo with virtual machine (VM): Mac in Orka Desktop and Windows in UTM.
Collaboration#
What might come up if working with other people on code/notebooks?
Hosted notebooks#
Jupyter can run on “on your computer (“local”), or in the cloud somewhere.”
Google Colab#
“Virtual machines are deleted when idle for a while, and have a maximum lifetime”
File storage is ephemeral
Supports mounting Google Drive
Comes with various packages pre-installed
Can install others
Integrated development environments (IDEs)#
Like Notepad/TextEdit/Notes vs. Word
Pros/cons?
Jupyter is kinda halfway
Getting even more powerful with generative AI integrations
Visual Studio Code (VSCode)#
Note to self: Switch to Computing in Context demo
Profile.
Set up project#
Go to open a folder/workspace
Navigate to where you want it
Click
New Folder
Name it something like
computing-in-context
Create Python file#
Create
test.py
Install Python extension, if necessary
Add code
print()
something
Confirm it’s using Python installed via Anaconda
Can have multiple Pythons
Show:
Syntax issue
Unused
import
Auto import
Version control#
When you’re editing a file and make a mistake, what do you do?
Undo/redo are useful
How would you try out a change that touches multiple files?
Git#
In sidebar, click Source Control
Install Git, if necessary
Many ways to install
Mac: Use Anaconda
Windows: Use Git for Windows
There are a lot of options in the installer - safe to stick to the defaults
Go to Explorer
Open integrated terminal
Windows:
Select Default Profile
to beGit BASH
Set global name and email in Git
Your name and email can be set to whatever
-
“There are no staged changes” -> “Always”
Command line#
Can use from within VSCode, or standalone
We’ll do the former, to stay in one place.
UNIX vs. Windows
Create notebook#
Create file
project_3.ipynb
-
Click
Install suggested extensions
, if it asks.Click
Python Environments…
Add a Markdown cell at the top, giving the notebook a title as a heading (level 1).
# Project 3
Add a couple code cells, doing some simple math.
Commit
Your Source Control Graph (a.k.a. your Git history) should then look something like this:
Hold onto this repository; you’ll use it through the end of the course.
Will get more into some of these things in more detail in Advanced Computing for Policy