> ## Documentation Index
> Fetch the complete documentation index at: https://fastapi2day.codewithsiva.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# VS Code Workspaces: Creating and Opening Python Projects

> Learn how to create a dedicated projects folder, open it in VS Code, and save a workspace file to quickly return to your project each day.

Before you write a single line of Python, it pays to spend two minutes setting up a clean folder structure. VS Code is designed to work with folders rather than individual files — opening a folder gives the editor full context about your project, which it uses to provide better suggestions, smarter imports, and accurate error detection. A well-organised folder from the start also makes everything easier as your projects grow.

## Create a projects folder

Start by creating a single parent folder on your computer that will hold all your Python work. This keeps everything in one predictable place.

<Steps>
  <Step title="Create your main projects folder">
    <CodeGroup>
      ```bash Windows theme={null}
      # In File Explorer, navigate to Documents and create:
      mkdir C:\Users\YourName\Documents\PythonProjects
      ```

      ```bash macOS theme={null}
      mkdir ~/PythonProjects
      ```

      ```bash Linux theme={null}
      mkdir ~/PythonProjects
      ```
    </CodeGroup>
  </Step>

  <Step title="Create your first project folder">
    Inside `PythonProjects`, create a folder for this course:

    <CodeGroup>
      ```bash Windows theme={null}
      mkdir C:\Users\YourName\Documents\PythonProjects\python-for-ai
      ```

      ```bash macOS / Linux theme={null}
      mkdir ~/PythonProjects/python-for-ai
      ```
    </CodeGroup>
  </Step>
</Steps>

<Note>
  Using lowercase letters and dashes (kebab-case) for folder names — like `python-for-ai` — is a convention shared by most Python projects and GitHub repositories. It avoids issues with spaces in paths and feels natural when you start working with the terminal.
</Note>

## Open the folder in VS Code

With your folder created, open it in VS Code using whichever method is most convenient:

**From VS Code:**

1. Click **File → Open Folder** (or press `Ctrl/Cmd + O`)
2. Navigate to your `python-for-ai` folder and click **Select Folder** (Windows) or **Open** (macOS/Linux)

**From your file manager:**

* **Windows:** Right-click the folder → **Open with Code**
* **macOS:** Drag the folder onto the VS Code dock icon
* **Linux:** Right-click the folder → **Open with Code**

**From the terminal:**

```bash theme={null}
cd ~/PythonProjects/python-for-ai
code .
```

## Understanding the VS Code interface

Once the folder is open, take a moment to orient yourself:

| Area                         | What it shows                                         |
| ---------------------------- | ----------------------------------------------------- |
| **Left sidebar → Explorer**  | All files and folders in your project                 |
| **Main editor area**         | The file you are currently editing                    |
| **Bottom panel**             | Terminal, Problems, Output, and Debug Console         |
| **Status bar (very bottom)** | Python interpreter, Git branch, errors/warnings count |

<Note>
  VS Code always operates on a folder, not just a file. This is why the Explorer panel shows your whole project tree. The editor uses this context to resolve imports, find related files, and understand your project layout.
</Note>

## Save as a workspace

A workspace file is a small bookmark that saves your project's settings and lets you reopen everything with a single double-click.

<Steps>
  <Step title="Save the workspace">
    With your folder open, click **File → Save Workspace As…**
  </Step>

  <Step title="Name and place the file">
    Save it inside the `python-for-ai` folder and name it `python-for-ai.code-workspace`.
  </Step>

  <Step title="Test it">
    Close VS Code completely, then double-click the `.code-workspace` file in your file manager. VS Code should open directly to your project.
  </Step>
</Steps>

A workspace file remembers:

* Which folders are part of your project
* Your project-specific editor settings (overriding global settings)
* Which files were open when you last closed the editor
* Your debugging configuration

<Tip>
  Create a shortcut to the `.code-workspace` file on your desktop or taskbar for instant access to your project every day.
</Tip>

## Your project structure so far

After completing these steps, your folder looks like this:

```text theme={null}
PythonProjects/
└── python-for-ai/
    └── python-for-ai.code-workspace
```

That is all you need for now. As the course progresses, Python files, notebooks, and a virtual environment folder will be added here.

<Card title="Your first Python file" icon="file-code" href="/getting-started/first-python-file">
  Create and run your first Python program in this workspace.
</Card>
