Setting Up Your Python Environment
A modern Python development setup involves three key components: the Python interpreter itself, a code editor, and a tool to manage project-specific dependencies. For this tutorial, we'll discuss how to set up Visual Studio Code (VS Code) as our editor and uv for environment and package management.
Installing VS Code:
You can download and install VS Code from the official website.
Installing uv:
uv is installed via a platform-specific command. Execute the appropriate command in your terminal.
Windows:
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"macOS / Linux:
curl -LsSf https://astral.sh/uv/install.sh | sh
After installation, restart your terminal session and verify the installation by checking the version:
uv --version
Setting Up Your Coding Environment:
In order to set up your coding environment, VS Code and uv are all we need. To set up your coding environment, follow these steps:
Open VS Code In Your Project Directory
Create a new directory for your project and navigate to it in your terminal. Then open the directory in VS Code by running code ..

Create a Virtual Environment
Create a virtual environment and set it as the default interpreter for VS Code. You can do this from VS Code by navigating to the terminal and running uv venv. This will download and install the latest version of python and will create a .venv directory in your project directory with the virtual environment. If you would like to use a specific version of Python, you can use the --python flag. For example, to use Python 3.12, you would run uv venv --python 3.12. To select the interpreter, open the command palette in VS Code by pressing Ctrl+Shift+P and typing Python: Select Interpreter. Then select the interpreter located in the .venv/Scripts (or .venv/bin) directory.

Run Some Code
Run some code to verify that the virtual environment is working. First create a file called hello_world.py and add the following code:
print("Hello, World!")
Then press the play button in the top right of the editor or press Ctrl+Alt+N to run the code.

Now You're Set!
You can now create and run Python files in your project directory.