The Setup
10 minutes of setup saves 100 hours of pain.
1. Your Editor
VS Code + two extensions. Without them, VS Code treats Python like plain text. No autocomplete, no error highlighting, nothing.
🧩 How?
Install VS Code from code.visualstudio.com
Verify Python is installed:
python --versionNo version number? Download from python.org.
Extensions (open Extensions sidebar in VS Code):
| Extension | What it gives you |
|---|---|
| Python (Microsoft) | Run and debug support |
| Pylance (Microsoft) | Autocomplete, type checking, error detection |
📌 Summary
| Task | What to do |
|---|---|
| Editor | VS Code |
| Verify Python | python --version |
| Extension 1 | Python (by Microsoft) |
| Extension 2 | Pylance (by Microsoft) |
2. UV
Python's default tooling is a mess. You need pip to install, venv to isolate, virtualenv as an alternative, and none of them talk to each other. UV replaces all of them. One tool. One command. Everything handled.
| Old way | The problem |
|---|---|
| pip | No project isolation, no lock file |
| venv + pip | Two tools, manual activation |
| pipenv | Slow, complex |
| poetry | Better, but still slow |
| UV | All of the above, fast |
🧩 How?
Install:
pip install uvCreate a project and run it:
uv init my-project
cd my-project
uv run main.pyNo virtual environment activation. No pip install. UV handles it.
📌 Summary
| Task | Command |
|---|---|
| Install UV | pip install uv |
| Create project | uv init project-name |
| Enter folder | cd project-name |
| Run code | uv run main.py |
3. Hello World
One line. Proof that everything works.
🧩 How?
Create main.py:
print("Hello World")Run it:
uv run main.pyHello WorldIf you see that, your setup is done.
4. Ruff
Bad formatting wastes time. Inconsistent code is hard to read. Ruff fixes both: it finds mistakes (linting) and cleans up your code (formatting), automatically, every time you save.
🧩 How?
Step 1: Install the Ruff extension (by Charlie Marsh) in VS Code.
Step 2: Add this to your VS Code settings.json:
"[python]": {
"editor.formatOnSave": true,
"editor.defaultFormatter": "charliermarsh.ruff"
}Save a messy file. Watch it snap into shape. That's Ruff.
📌 Summary
| Task | What to do |
|---|---|
| Install | Ruff extension in VS Code |
| Configure | editor.formatOnSave: true |
| Formatter | charliermarsh.ruff |
| How it works | Save your file, Ruff formats it |
5. Libraries
You don't build everything from scratch. Libraries are code someone else already wrote. Some come with Python. Some you install.
🧩 How?
Built-in (already on your machine):
import math
print(math.sqrt(16)) # 4.0
print(math.pi) # 3.14159...import random
print(random.randint(1, 10))
print(random.choice(["Ahmed", "Faadumo", "Yusuf"]))Installable (one command away):
uv add pyfigletimport pyfiglet
print(pyfiglet.figlet_format("BASHI")) ____ _ ____ _ _ ___
| __ ) / \ / ___|| | | |_ _|
| _ \ / _ \ \___ \| |_| || |
| |_) / ___ \ ___) | _ || |
|____/_/ \_\____/|_| |_|___|📌 Summary
| Type | Example | How |
|---|---|---|
| Built-in | math, random | import math |
| Installable | pyfiglet | uv add pyfiglet → import pyfiglet |
Cheat Sheet
python --version # verify Python
pip install uv # install UV
uv init my-project # create project
cd my-project
uv run main.py # run code
uv add pyfiglet # install a libraryThe Setup in 4 steps: