Setup & Tooling
Five minutes of setup will save you fifty hours of pain. Let's build your Python workspace the right way — once.
▶ Watch this reelWhat you'll learn
- Python versions & install
- venv & uv/pip
- pyproject.toml & requirements
- IDE setup
- Jupyter notebooks
Remember this
- Pin one Python version per project; uv or pyenv switches between them
- Every project gets its own venv — never install into system Python
- Declare dependencies in pyproject.toml + a lockfile; use Jupyter only for experiments
Python versions
- Many versions coexist; pin one per project (
requires-python = ">=3.13"). - Install via python.org, Homebrew, or
uv python install 3.13. python --version+which pythonare your sanity checks.
Virtual environments (venv)
- Isolated per-project package folders — mandatory, not optional.
python -m venv .venv→source .venv/bin/activate→pip install ...- Windows:
.venv\Scripts\activate. - uv (astral.sh): drop-in pip replacement, 10-100x faster; also manages Python versions.
Dependency declaration
| File | Role |
|---|---|
pyproject.toml | Metadata + dependencies + tool config (the standard) |
uv.lock / requirements.txt | Exact pinned versions for reproducibility |
IDE
- VS Code + Python + Pylance + Ruff extensions.
- Ruff = formatter + linter in one (replaces Black/isort/flake8).
- Debugger: one
launch.json, then F5, breakpoints, stepping.
Jupyter
- Cells run individually (Shift+Enter); output stays inline.
- Ideal for data exploration and LLM prompt experiments.
- Pitfalls: out-of-order execution hides broken state; poor git diffs. Keep shippable code in
.pyfiles.
Code: Day-one setup — from zero to a working project
# 1. Install a Python version (once)
# uv python install 3.13
# 2. Create a project + virtual environment
mkdir myproject && cd myproject
uv venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
# 3. Declare dependencies in pyproject.toml
# [project]
# name = "myproject"
# requires-python = ">=3.13"
# dependencies = ["httpx"]
# 4. Install + lock (reproducible!)
uv pip install httpx
uv lock
# 5. Verify which Python you're using
python --version
which python # should point inside .venv/