Python Dev Setup

Welcome to <INSERT COURSE USING PYTHON HERE>! This page has setup instructions for the various technologies that we will need for assignments and exercises in each course.

Depending on which course you're first reading this tutorial within, you may or may not have completed certain steps -- feel free to jump around to only those components you're missing.

We will complete tutorials with how to use each of the following in-class and through assignments, but having them downloaded in advance will make the most out of your time in class.


Setup Git & GitHub


  1. If you haven't already, sign up for GitHub here

  2. Note that Git has deprecated password authentication and requires you to authenticate using either ssh keys or auth tokens!

    Even if you used GitHub in the past, you will need to configure a new authentication method such as here.

  3. Download the git terminal tools here.

    If you are using a Windows computer, make sure to install Git Bash as part of the installation process in the above -- you'll use this instead of the basic command line for your terminal, as it just tends to work better for our objectives.

  4. Open a new terminal/git bash window and type git and enter -- if you see a bunch of options pop up, you're good to go!


Install Python


  1. Start by downloading the latest version of Python here:

    Python Download


  2. Open a terminal and verify the installation by typing python --version or python3 --version, which should show you the version number of Python that you just installed.

    If you had an existing terminal open before downloading Python, open a new one to refresh the path.


Download Dependencies


  1. We will be using the pytest library to run unit tests, especially for making sure that your implementations of assignments are efficient / don't have any infinite loops / recursion. Install using the instructions here (most simple way, by opening a terminal and typing pip install pytest):

    pytest Download


    Important: a related dependency will make sure that your tests run efficiently / within the time allowed by the unit tests. You should also install the pytest-timeout package for this: pip install pytest-timeout

  2. For classes requiring it, we will be using type annotations in Python, which will be checked / enforced via the mypy library, which can be downloaded here (most simple way, by opening a terminal and typing pip install mypy):

    mypy Download


  3. Having trouble finding pytest and mypy in the terminal? This usually happens if you have multiple versions of Python installed. A couple of things to try:

    • Trying to run these in an IDE like VSCode? Don't. Instead, switch to an external terminal like Terminal on Macs and GitBash on Windows machines.

    • Do you have the python3 alias mapping to your Python 3.X version? You might need to instead install via pip3 install pytest pytest-timeout mypy and then execute using python3

    • If all else fails, you can always directly invoke the libraries via the -m parameter, e.g., python -m mypy and python -m pytest (or, in the case of the bullet above, use python3 -m mypy etc.)

  4. You should always verify that mypy and pytest are correctly installed by opening a terminal and typing these executables to see if they're found.


Install an IDE


An Integrated Development Environment (IDE) is a program that bundles many helpers for software development, including: language-specific text editors, compiler warnings, code suggestions, debuggers, unit-test integration, and much more!

There are many IDEs that are suitable for Python development; in fact, even simple text editors like Sublime or Notepad++ are fine for editing Python source and then executing at the terminal.

  1. That said, Visual Studio Code (VSCode) is the current IDE-du-jur for Python development and can be obtained here:

    VSCode Download


  2. Install the Python Extension in VSCode following its tutorial here:

    VSCode Basics Tutorial


  3. Install any necessary test Extensions in VSCode following its tutorial here:

    VSCode Testing Tutorial


Warning: Many VSCode plugins for some of the class' dependencies (e.g., mypy) are buggy and hard to configure. ALWAYS run your submissions at the terminal at least once before submitting to double check your work.



  PDF / Print