Watch the video above if you want a click-by-click walkthrough on Windows. Bookmark this companion page next to your terminal as a copy-paste command cheat sheet, 6-file project map, and Windows troubleshooting guide for uv + Git.
Almost every Python tutorial starts by telling you to download a global Python installer and run pip install. That works for project one, and breaks the day project two needs a different package version.
A durable Python setup rests on three isolated pieces:
- A project folder: Everything for one project lives in one directory; delete the folder and the project is gone cleanly.
- A per-project virtual environment (
.venv): Think of a family sharing one pair of glasses: grandma needs+2.5and a younger sibling needs-1.5. One global Python install cannot serve conflicting projects; each project gets its own pair of glasses. - Git save points: Versioned checkpoints so you can inspect mistakes (
git diff) and roll back (git restore) in seconds.
uv builds the folder, fetches Python automatically, creates .venv, and initializes Git in one workflow, without ever touching a global Python installer or manually activating environments on Windows.
One-Screen Windows Command Reference
1. Check before installing
Always check first so you don’t end up with duplicate copies of tools:
uv --version
git --version
2. Install Git and uv (only if missing)
Run in Windows PowerShell:
winget install Git.Git
git config --global user.name "Your Name"
git config --global user.email "your.email@example.com"
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
Tip: If PowerShell still says uv or git is not recognized right after installing, close and open a new terminal (or restart your editor).
3. Initialize a project, add a dev tool, and verify
uv init learn-python
cd learn-python
uv add --dev pytest
uv run python --version
uv run learn-python
Notice what is missing: no python.org installer, no “Add Python to PATH” checkbox, and no manual git init (uv init already initialized Git for you).
4. Create your first Git save point and roll back mistakes
git status
git add .
git commit -m "Initial commit"
When a code edit breaks something later, inspect and revert cleanly:
git status
git diff
git restore src/learn_python/__init__.py
The 6-File Project Anatomy: What Each File Does
Every file uv init creates has one specific job; nothing is magic:
| File / Folder | Role in Plain English | Edit by Hand? | Tracked by Git? |
|---|---|---|---|
src/learn_python/__init__.py | Your actual source code (__init__.py marks the folder as a Python package; underscores replace hyphens because Python reads - as minus) | Yes | Yes |
pyproject.toml | The project’s ID card: name, accepted requires-python range, runtime dependencies, [dependency-groups] dev tools (like pytest), and [project.scripts] commands | Yes (or via uv add) | Yes |
.python-version | Pins the exact Python version uv selected for this project | Rarely | Yes |
uv.lock | Exact version snapshot of every package and sub-dependency | Never (uv manages it) | Yes |
.venv/ | The installed environment (“the glasses”), plus pyvenv.cfg pointing to uv‘s central Python copy | Never | No (ignored in .gitignore) |
.gitignore & README.md | Tells Git to skip .venv/ (“keep the prescription, not the glasses”) + project front page for GitHub | Yes | Yes |
Three Windows Friction Points uv Eliminates
- No
.venv\Scripts\activatePowerShell errors: Traditional tutorials require activating the virtual environment in every new terminal, often triggering Windows PowerShell execution-policy red errors before you write a single line of Python. Withuv run <command>,uvautomatically syncs and runs inside the project’s.venvevery time without activation. - Disposable environments: Because
uvkeeps a single shared Python copy outside your project and records the exact environment inpyproject.toml+uv.lock, you can delete.venv/completely and runuv run learn-python;uvrebuilds.venvin about a second. - Clean edit-save-run loop:
uvinstalls yoursrc/package in editable mode, so every time you editsrc/learn_python/__init__.pyand runuv run learn-python, it immediately runs your updated code without reinstalling.
Links & Resources
- YouTube Walkthrough: https://www.youtube.com/watch?v=xgYrLbQcwa8
- Official
uvDocumentation: https://docs.astral.sh/uv/
