Weekly overview

Week 1

Python Setup with uv

Welcome to this guide on setting up your Python development environment using the powerful package manager called uv.

A properly configured development environment is crucial for efficient coding. It helps manage dependencies, keeps your projects organized, and provides powerful tools that make coding easier and more enjoyable. The uv package manager we’ll be using is a modern, fast alternative to traditional Python package managers.

Step 1: Apply for GitHub Student Developer Pack 🎓

The GitHub Student Developer Pack provides students with free access to the best developer tools.

  1. Visit GitHub Student Developer Pack
  2. Click on “Get your pack”
  3. Sign in with your GitHub account (or create one if you don’t have it)
  4. Verify your student status using your school-issued email
  5. Complete the application form
  6. Wait for approval (usually takes 1-7 days)

Why this matters: The pack includes free access to GitHub Copilot, which is an AI pair programmer that will help you write better code faster.

Step 2: Install Visual Studio Code 💻

VS Code is a lightweight but powerful source code editor.

During installation on Windows, check the options “Add ‘Open with Code’ action to Windows Explorer file context menu” and “Add ‘Open with Code’ action to Windows Explorer directory context menu” for easier access.

  1. Go to VS Code download page
  2. Download the appropriate version for your operating system
  3. Run the installer and follow the on-screen instructions
  4. Launch VS Code after installation

To be able to open VS Code from the command line interface using code . command:

  1. Open VS Code
  2. Press Cmd+Shift+P to open the Command Palette
  3. Type “shell command” and select “Shell Command: Install ‘code’ command in PATH”
  4. Restart your terminal for changes to take effect

Step 3: Install Essential VS Code Extensions 🧩

Extensions enhance VS Code with additional features. We’ll install three key extensions.

In VS Code, click on the Extensions icon in the sidebar (or press: Windows Ctrl+Shift+X / mac: Cmd+Shift+X).

Python Extension

  1. Search for “Python”
  2. Find the extension by Microsoft (usually the first result)
  3. Click “Install”

GitHub Copilot

  1. Search for “GitHub Copilot” in the Extensions marketplace
  2. Click “Install”
  3. After installation, sign in with your GitHub account using the account icon in the lower left sidebar
  4. You’ll be prompted to authorize VS Code to use GitHub Copilot

GitHub Copilot Chat

  1. Search for “GitHub Copilot Chat” in the Extensions marketplace
  2. Click “Install”
  3. This extension works alongside GitHub Copilot to provide conversational AI assistance

Note: GitHub Copilot requires a subscription, but it’s free with the GitHub Student Developer Pack you applied for in Step 1.

You can enhance Copilot’s chat responses by providing it with contextual details about your workflow, tools, or project specifics. Instead of manually including this context in every chat query, you can create a custom instructions file that automatically incorporates this information with every chat request.

Step 4: Install uv Package Manager ⚡

uv is a fast, modern Python package manager and resolver.

For Windows (PowerShell):

  1. Open PowerShell
  2. Run the following command:
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
  1. Restart your PowerShell session to ensure uv is in your PATH

For macOS/Linux (Terminal):

  1. Open Terminal
  2. Run the following command:
curl -LsSf https://astral.sh/uv/install.sh | sh

If your system doesn’t have curl, you can use wget:

wget -qO- https://astral.sh/uv/install.sh | sh
  1. Close and reopen your terminal to ensure uv is in your PATH

Verify installation: Type uv --version in your command line interface. You should see the version number of uv displayed.

Step 5: Initialize Your First Project

Now let’s create a new Python project structure using uv:

  1. Open your command line interface (PowerShell on Windows or Terminal on Mac/Linux)
  2. Simply type the following command directly in your command line or first navigate to the directory where you want to create your project (e.g., cd Documents)
  3. Run the following command to initialize a new project named “genai-app” with Python 3.11:
uv init genai-app --python 3.11
  • Creates a new directory called genai-app
  • Sets up a project structure with Python 3.11
  • Creates initial configuration files

Step 6: Navigate to Your Project Directory 📁

Let’s move into your newly created project directory:

cd genai-app

Check the directory contents: You can use dir (Windows) or ls (macOS/Linux) to see what files were created.

Step 7: Activate your Virtual Python Environment 🔄

A virtual environment is an isolated space where you can install packages without affecting your global Python installation. We can create and activate this environment with:

Important

After using uv sync, you should not move your genai-app folder to a different location. Doing so may break path references and prevent your environment from working properly.

uv sync
  • Creates a virtual environment for your project
  • Sets up the environment based on your project’s specifications
  • This environment is isolated from your system Python installation

If you encounter a “Permission Denied” error, use the command with sudo to use administrative privileges:

sudo uv sync

Step 8: Install Required Packages 📦

Let’s add some commonly used packages for AI and data science projects:

uv add pandas python-dotenv openai gradio streamlit
  • pandas: A beginner-friendly library that helps you work with data tables (like Excel spreadsheets)
  • python-dotenv: Helps keep your passwords and API keys safe by storing them in a separate file
  • openai: Connects your code to AI services like ChatGPT
  • gradio: Creates simple web interfaces for your AI projects with minimal coding
  • streamlit: Turns your Python scripts into interactive web apps with just a few lines of code

Step 9: Open your project in VS Code

Now let’s open your new project in VS Code where we’ll write our code:

  1. Open VS Code
  2. Click on “File” in the top menu on the left
  3. Select “Open Folder…”
  4. Find and select your genai-app folder

When you’re in your command line, this command opens VS Code in your current directory (the . represents “current location”).

code .

Step 10:Activate Your Virtual Environment ✅

Use your command line to activate your Virtual Environment in your genai-app folder:

  • On Windows:
.venv\Scripts\Activate
  • On macOS/Linux:
source .venv/bin/activate

If you encounter a “Permission Denied” error, use the commands with sudo to use administrative privileges:

  • On Windows:

    .venv\Scripts\Activate
  • On macOS/Linux:

    sudo source .venv/bin/activate

Step 11: Run Your First Python Program 🏃‍♀️

Let’s make sure everything is working by running the example file. In your command line, type:

python3 main.py

You should see a “Hello, world!” message appear. This confirms that: 1. Your Python is working correctly 2. Your virtual environment is active 3. You’re ready to start coding!

Troubleshooting Common Issues 🔧

Package Installation Problems
If you see errors when adding packages:

  1. Check that you’re connected to the internet
  2. Try running uv sync again to refresh your environment
  3. Read the error message carefully - it often tells you exactly what went wrong

“Command Not Found” Error
If your computer can’t find the uv command:

  1. Close your terminal completely and open a new one
  2. If that doesn’t work, you might need to add uv to your PATH (the list of places your computer looks for programs)
  3. As a last resort, try reinstalling using the commands from Step 4

VS Code Extensions Not Working
If the extensions we installed aren’t behaving correctly:

  1. Make sure you’ve signed in to your GitHub account in VS Code
  2. Try updating VS Code to the latest version
  3. You can reinstall extensions by uninstalling them first, then installing again

“Permission Denied” error

If you encounter a “Permission Denied” error in your command line, it’s typically a file system permissions issue. Your user account lacks sufficient permissions to write to the directory where operations are being attempted.

  • Windows: Click on the provided hyperlik in the error message and follow the instructions.
  • Mac: To modify permissions for a directory (e.g., “genai-app”) in your current working directory:
chmod 755 ./genai-app

Permission Values:

  • 755: Owner can read/write/execute; others can read/execute
  • 700: Only owner can read/write/execute
  • 777: Everyone can read/write/execute (use with caution)

Conclusion 🎯

Congratulations! You’ve successfully set up a Python development environment using uv. This modern setup will serve you well as you progress in your programming journey. Remember that learning to code is a marathon, not a sprint – take your time to understand each concept thoroughly.

Happy coding! 💻✨

Additional Resources 📖

Week 2

No lecture

Week 3

Installation of packages

Follow these steps to set up your environment:

  1. Open your command line (Terminal or PowerShell)
  2. Navigate to your genai-app folder
  3. Add the necessary packages:
uv add pandas python-dotenv openai gradio streamlit

Download .env file

  • Download the .env file from Moodle
  • Unzip the file and move it into your genai-app project folder
  • Make sure to add the .env file to your .gitignore file to prevent accidentally sharing sensitive environment variables when pushing to a repository (what is a .gitignore file?).

💡 Mac users: The .env file is hidden by default. Use the shortcut
Cmd + Shift + . in Finder to show hidden files.

Create marketing app

Next, we’ll build an AI-powered marketing app with gradio and the OpenAI-API:

  • Open genai-app as a Folder in VS Code.
  • To generate the code, use GitHub Copilot Edits:
    • Mac: Press cmd+Shift+i
    • Windows: Press ctrl+Shift+i

Next, enter this prompt in the GitHub Copilot Edits window:

Create an AI powered Python Instagram content generator.

Tech stack:
- Gradio UI
- OpenAI API
- python-dotenv

Requirements:
1. Load OPENAI_API_KEY from .env
2. Use client.chat.completions.create() API format
3. Name the gradio file app.py
4. Gradio interface with:
   - Content type selector (carousel/post/reel/story)
   - Target group selection
   - Topic input field
   - Output area for generated content

Run marketing app

  1. Open Powershell or Terminal and change into your genai-app directory. Activate Your Virtual Environment in your genai-app folder:

On Windows:

.venv\Scripts\Activate

On macOS/Linux:

source .venv/bin/activate

If you encounter a “Permission Denied” error, use the commands with sudo to use administrative privileges:

On Windows:

sudo .venv\Scripts\Activate

On macOS/Linux:

sudo source .venv/bin/activate

How to solve this issue permanently: If you encounter a “Permission Denied” error in your command line, it’s typically a file system permissions issue. Your user account lacks sufficient permissions to write to the directory where operations are being attempted.

Windows: Click on the provided hyperlik in the error message and follow the instructions.

Mac: To modify permissions for a directory (e.g., “genai-app”) in your current working directory:

chmod 755 ./genai-app

Permission Values:

  • 755: Owner can read/write/execute; others can read/execute
  • 700: Only owner can read/write/execute
  • 777: Everyone can read/write/execute (use with caution)
  1. Start the gradio app with this command
python app.py

Copy the URL (https://…) from the terminal output and paste it into your browser to access the application.

If you encounter an error, carefully review the error message for troubleshooting clues.

Week 4

This guide helps you set up a Python project using OpenAI’s Responses API. You’ll learn how to initialize your project, install required packages, and configure your environment using a .env file.

🔧 Step 1: Create a New Project

To start, open your terminal or PowerShell and run the following command:

uv init responses-api --python 3.11

This command will:

  • Create a new folder named responses-api
  • Set up a Python 3.11 virtual environment
  • Generate basic project files

Note: You need to have uv installed. It’s a fast Python package manager.


📁 Step 2: Change into the Project Directory

Navigate into your new project folder:

cd responses-api

🔄 Step 3: Sync the Project Environment

Synchronize the project dependencies and initialize the virtual environment:

uv sync

This will create a virtual environment and install any dependencies listed in requirements.lock.


✅ Step 4: Activate the Virtual Environment

For macOS and Linux:

source .venv/bin/activate

For Windows (using PowerShell):

For PowerShell:

.venv\Scripts\Activate.ps1

📦 Step 5: Install Required Packages

You need two packages:

  • openai: To access the OpenAI API
  • python-dotenv: To manage environment variables from a .env file

Install them by running:

uv add openai python-dotenv

🔑 Step 6: Add Your OpenAI API Key

  1. Go to Moodle and get the .env file
  2. Add the .env in your project folder.

The file looks like this:

OPENAI_API_KEY=your_api_key_here

📚 Step 7: Learn About the OpenAI Responses API

You can find full documentation for the Responses API here:

These resources explain how to structure your API calls, the different response types, and how to interpret the results.


Week 5

Week 6

  • Online-Appointments

Week 7

  • Online-Appointments

Week 8

  • News from the world of AI
  • COMPASS-Framework
  • Social Media Analytics