1  Getting Started

1.1 Set up your code editor

When editing code more extensively we want to have a so called integrated development environment (IDE). There are many options out there. Do not spend too much time deciding which to pick, you can always change your choice later.
VS-Code is a reasonable general choice as of today, it is free and widely adopted. For a user experience more similar to matlab or R-studio and oriented to scientific computing you can check out Spyder.

1.2 Set up Python with uv

We essentially need to carry out three tasks:

  • Install Python (the language itself)
  • Manage virtual environments
  • Install third party libraries

We will use here uv which is a high level tool that does all three for us.

1.2.1 Install uv

Run only one of these commands in your terminal - pick according to your operating system:

Linux and macOS

curl -LsSf https://astral.sh/uv/install.sh | sh

Windows

Important

Make sure to use powershell! (default if you execute this in the VSCode terminal).

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

That should be enough, but for more details you can follow detailed instructions here.

If everything worked fine you should be able to open a terminal and run this:

uv run python

and see a python REPL similar to this (it’s OK if you see something slightly different):

1.2.2 Working on a project

To start a new project run in your terminal:

uv init pycourse --lib --python 3.12

pycourse is the name of the project, you can choose anything you want.
The --lib flag tells uv to install the current code as a “library” (don’t worry about this yet, it’s just something we need to get things working for now).
The --python flags specifies the specific python version we want to work with in this project. If the version is already installed in our machine uv will just use it, otherwise uv will download it and keep it for future usage.

uv will create a new directory with all the necessary boilerplate to get python running, including a virtual environment (by default, under the hidden directory .venv) and a pyproject.toml file (we’ll look at those later when dealing with dependencies).
For more details on uv and projects see the documentation here.

Change your directory into the newly created folder:

cd pycourse

You should see a structure like this:

pycourse
├── pyproject.toml
├── README.md
└── src
    └── pycourse
        └── __init__.py

1.3 Set up Git and GitHub

If you don’t yet have one, set up a free GitHub account.

Also, make sure to install Git in your machine.

We’re ready to go 🚀!