Setup Your AI Environment

Welcome to the first practical step of your Python + Copilot journey! Before we start writing prompts and building Python projects, you need to set up a development environment where you and GitHub Copilot can work together seamlessly.

In this module, we’ll guide you step-by-step through everything you need — from installing Visual Studio Code to writing your very first AI-assisted Python function.

What You Need Before You Start

Before diving in, here’s a quick checklist:

  • A computer (Windows, macOS, or Linux)
  • A stable internet connection
  • A GitHub account (if you don’t have one, sign up here)
  • Basic familiarity with downloading and installing software (don’t worry, we’ll guide each step)

Installing Visual Studio Code (VS Code)

VS Code is a lightweight, powerful, and widely used code editor developed by Microsoft. It’s the preferred environment for using GitHub Copilot.

Steps to install VS Code:

  1. Download the installer
    Go to the official VS Code download page and choose your operating system (Windows, macOS, or Linux).
  2. Run the installer
    Follow the installation wizard instructions. On Windows, make sure you check "Add to PATH" if available — this makes it easier to run VS Code from the terminal.
  3. Launch VS Code
    Once installed, open VS Code. You’ll see a clean, customizable interface ready to support multiple programming languages.

Installing Python

To run Python code, you need to have Python installed on your system.

Steps to install Python:

  • Download Python
    Visit the official Python download page.
  • Select the latest version
    Choose the most recent stable release (e.g., Python 3.x.x). Click "Download."
  • Run the installer
    On Windows, make sure to check "Add Python to PATH" before clicking "Install Now." On macOS and Linux, follow the prompts.
  • Verify installation
    Open a terminal or command prompt and type:
1
python --version

or

1
python3 --version
  • You should see a version number, confirming Python is installed correctly.

Installing the GitHub Copilot Extension

GitHub Copilot integrates directly into VS Code through an extension.

Steps to install:

  • Open VS Code
  • Go to Extensions panel
    You can access it by clicking the square icon on the left sidebar or pressing Ctrl + Shift + X (Windows/Linux) or Cmd + Shift + X (macOS).
  • Search for "GitHub Copilot"
    In the search bar, type "GitHub Copilot."
  • Click "Install"
    Find the official GitHub Copilot extension by GitHub and click Install.

Once installed, you may see a prompt to sign in and authorize access.

Linking Your GitHub Account

To use Copilot, you need to link your GitHub account with an active Copilot subscription or trial.

  • Sign in to GitHub
    In VS Code, after installing Copilot, you’ll see a prompt saying "Sign in to GitHub" or "Authorize GitHub Copilot." Click it.
  • Authorize in your browser
    Your browser will open a GitHub login page. Sign in and approve the permissions for VS Code.
  • Return to VS Code
    After successful authorization, VS Code will show a confirmation message.
Tip: If you run into issues, check your VS Code status bar — there should be an icon indicating Copilot is active.

Configuring Copilot in VS Code

Once linked, let’s make sure Copilot is ready to suggest code.

Basic configuration:

  • Open Command Palette
    Press Ctrl + Shift + P (Windows/Linux) or Cmd + Shift + P (macOS).
  • Search for "Copilot"
    Type Copilot to see available commands, such as "Enable Copilot," "Disable Copilot," and "Open Copilot Settings."
  • Enable inline suggestions
    Make sure "Inline Suggestions" is turned on so Copilot can automatically show completions as you type.
  • Optional settings
    You can customize behavior like showing multiple suggestions or enabling/disabling automatic completions in your settings file (settings.json).

First Test Prompt: Hello World with Copilot

Now that everything is set up, it’s time to write your first AI-generated Python function!

Steps:

  • Create a new Python file In VS Code, go to File > New File, save it as hello.py.
  • Write a prompt comment Type the following comment at the top of your file:
1
# Write a Python function that prints 'Hello, World!'
  • Start typing: Below the comment, start typing def. You should see Copilot suggest:
python
1
2
def hello_world():
    print("Hello, World!")
  • Accept the suggestion Press Tab (or the accept key shown on screen) to insert the suggested code.
Post Image
  • Run your code
  • Add:
python
1
hello_world()

Save and run the file:

text
1
python hello.py

You should see:

1
Hello, World!
Congratulations! You just wrote your first Python function using GitHub Copilot.

Summary

In this module, you’ve:

  • Installed VS Code and Python
  • Set up GitHub Copilot
  • Linked your GitHub account and configured Copilot in VS Code
  • Written your first prompt-driven Python function

You now have a fully operational environment to explore Python with the help of your new AI coding partner.

Frequently Asked Questions