chapter five

5 Setting up VS Code and your Python development environment

This chapter covers

  • What VS Code is and why developers use it
  • Installing VS Code and Python with Homebrew
  • Installing the Python extension for syntax highlighting and error detection
  • Using the integrated terminal to run commands without leaving the editor
  • Creating a project folder and running your first Python script

So far, you have been using the terminal to run Ollama commands and chat with AI models. That works well for quick interactions, but to build a real application, such as a chatbot with a graphical interface that calls the model programmatically, you need to write Python code. Knowing basic Python fundamentals will be helpful from this point forward, especially concepts like functions, variables, files, and packages. Do not worry if those terms are new to you; this chapter will walk you through setting up the tools, and subsequent chapters will teach you the code one step at a time.

5.1 What is VS Code?

5.2 Installing VS Code

5.2.1 Step 1: Install with Homebrew

5.2.2 Step 2: Verify the installation

5.2.3 Step 3: Open VS Code

5.3 Installing Python 3.13

5.4 Installing the Python extension

5.4.1 Installation steps

5.4.2 What you will see in practice

5.5 Using the integrated terminal

5.5.1 Opening the terminal

5.5.2 Verifying your tools

5.6 Creating your project folder

5.6.1 Setting up the workspace

5.6.2 Creating and running your first file

5.6.3 Project structure preview

Exercises

Summary