Skip to content

Setting Up Python

This content is not available in your language yet.

For our project we will be using Python with UV as the package manager.

If it wasn’t installed during your installation of VSCode, Python is most easily added using the built in extensions manager in VSCode.

The extension manager can be found on the sidebar to the left, with the image of four boxes.

Search “Python” and install the Python package. This will add support for the Python Language. If the install button isn’t visible, you’ll already have it installed and can move on.

Installing Python

  1. To install UV, we can follow the instructions on the official documentation.

    this will likely mean simply running:

    Terminal window
    pip install uv

    However, if for whatever reason that doesn’t work for you, try doing the following: (Only do this if pip didn’t work)

    Terminal window
    Set-ExecutionPolicy RemoteSigned -scope CurrentUser

    followed by

    Terminal window
    powershell -c "irm https://astral.sh/uv/install.ps1 | iex"

    In the Terminal.

  2. Next, to ensure UV installed correctly, run

    Terminal window
    uv

    in the terminal.

    If you get an error, you’ll likely need to restart your device to ensure UV is installed correctly. If you get an output showing different commands, you can move on.

  3. Then we can create our project by typing

    Terminal window
    uv init

    in the terminal.

We can create a virtual environment using the following terminal command

Terminal window
uv venv

to make the Virtual Environment active, you’ll want to run

Terminal window
.venv/Scripts/activate

You can tell you the Venv is activated, if your project name is now in brackets at the start of your terminal line.

For more information about what a virtual environment is and how it works, you can look at the official python docs

Instead of interacting with the Virtual Env directly it is easier to run scripts using the following command in the terminal

Terminal window
uv run my_script.py

For code style and formatting we will be using Ruff which can be installed using the following command in the terminal

Terminal window
uv add ruff
Contribute Donate