Learn / Local AI & Tooling / Module 01

Local AI & Tooling · Module 01

Reproducible Python Projects with uv and Git

Stop debugging "it works on my machine" environments by setting up fast, lockfile-pinned Python projects with uv and clean Git habits.

10 min Foundations Updated 2026-12-03 PythonuvGitReproducibility
Silent visual walkthrough. Read the lesson.

<!-- Thompson Axiomata LLC — Brent Alexander Thompson -->

Why global pip install breaks every project eventually

Installing packages straight into your system Python works on Day 1—until Project A needs pydantic 2.10 and Project B breaks on anything above 2.6, or a teammate clones your repo and hits five missing imports.

uv replaces venv, pip, pip-tools, and pyenv with one fast tool backed by standard pyproject.toml and uv.lock files.

Start a clean project in four commands

bash
# 1. Create a new project folder with pyproject.toml and a starter script
uv init my-project
cd my-project

# 2. Add dependencies (automatically creates .venv and updates uv.lock)
uv add pandas pydantic httpx

# 3. Add dev-only tools like pytest or ruff
uv add --dev pytest ruff

# 4. Run code inside the managed environment without manual activation
uv run python main.py
uv run pytest

When someone else (or a CI runner or HPC node) clones your repository, one command recreates the exact same package versions:

bash
uv sync --frozen

Four Git habits that save hours later

HabitWhy it matters
Ignore generated & local artifactsKeep .venv/, __pycache__/, dist/, .env, and raw multi-GB data out of Git via .gitignore.
Commit uv.lock for appsGuarantees everyone gets identical transitive dependency versions.
Keep commits small and focusedOne logical change per commit makes git diff and git revert painless.
Check git status and git diff before committingCatches accidental secrets, debug prints, or stray files before they hit history.

Minimal .gitignore starter for Python data & AI repos

gitignore
.venv/
__pycache__/
*.pyc
.pytest_cache/
dist/
.env
*.sqlite
*.db

<!-- Thompson Axiomata LLC — Brent Alexander Thompson -->

Finished this module?

Mark it complete to update your browser-local progress bar for Local AI & Tooling.