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.

Aidan Feldman

Computing in Context (SIPA)

Structure for today

  1. Intro

  2. Going over course info like the syllabus, tools, etc.

  3. IDEs

  4. Command line

  5. Packages

About me

  • Coding since 2005 🖥

  • Government since 2014 🦅

  • Teaching since 2011 🎓

  • Also a modern dancer 💃 and cyclist 🚲

Day jobs

Currently freelancing with:

In the past, have worked for...

Tech companies

Access the course site

computing-in-context.afeld.me

You can also get there through CourseWorks.

Class materials

New context-specific stuff:

Disclaimers

Me

  • Here to teach you to:

    • Do a lot with just a little code

    • Troubleshoot

    • Google stuff

  • Terrible memory

    • Names

  • Not a statistician

You

  • Are not going to understand everything the first time

  • Will want to throw your computer out a window at one or many points in the class

    • Celebrate the little victories

  • Will get out of it what you put into it

Politics/protests/war

⏪ Rewind

These next two lectures, we’ll be revisiting topics from the first half.

Python

  • Language

  • Interpretor

languages
  • Language

  • Interpretor

  • Editor (VSCode)

  • 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

Editors

  • Spectrum: Minimalist editors to integrated development environments (IDEs)

  • Like Notepad/TextEdit/Notes vs. Word / Google Docs

    • Pros/cons?

  • 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

  1. Go to open a folder/workspace

  2. If you don’t have a class folder already:

    1. Navigate to where you want it.

    2. Click New Folder.

    3. Name it something like computing-in-context.

Extensions

Install extensions, if they aren’t already:

Configuration

  1. Open your User Settings JSON.

  2. Add the following. You may already have some settings — if you want to keep them, you’ll need to combine.

    {
      // https://marketplace.visualstudio.com/items?itemName=charliermarsh.ruff#configuring-vs-code
      "editor.formatOnSave": true,
      "[python]": {
        "editor.defaultFormatter": "charliermarsh.ruff",
        "editor.codeActionsOnSave": {
          "source.organizeImports": "explicit"
        }
      },
      "notebook.formatOnSave.enabled": true,
      "notebook.codeActionsOnSave": {
        "notebook.source.organizeImports": "explicit"
      }
    }

Confirm it works

  1. Put some ill-formatted code (like 1 + 1) in test.py.

  2. Save the file.

  3. Confirm the extra spaces were automatically removed.

Create Python file

  1. Create test.py

  2. Add code

    • print() something

  3. Confirm it’s using Python through the venv.

    • Can have multiple Pythons

  4. Run script

  5. Show:

    1. Syntax issue

    2. Unused import

    3. Auto import

Command line

Quick tips

  • You can press the up arrow on your keyboard to get to previously-run commands, rather than having to re-type it each time.

  • You can press control-R then type something to search through your command history. Press control-R again to see the next result.

Packages

  • a.k.a. “libraries”

  • Developers have create them to make code/functionality reusable and easily sharable

  • Software plugins that you import

  • Main packages we’ll use:

    • jupyter-book

    • pandas

    • plotly

A module is a file containing Python definitions and statements.

https://docs.python.org/3/tutorial/modules.html

Your code, part of the standard library, or part of a package.