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.
<!-- 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
# 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 pytestWhen someone else (or a CI runner or HPC node) clones your repository, one command recreates the exact same package versions:
uv sync --frozenFour Git habits that save hours later
| Habit | Why it matters |
|---|---|
| Ignore generated & local artifacts | Keep .venv/, __pycache__/, dist/, .env, and raw multi-GB data out of Git via .gitignore. |
Commit uv.lock for apps | Guarantees everyone gets identical transitive dependency versions. |
| Keep commits small and focused | One logical change per commit makes git diff and git revert painless. |
Check git status and git diff before committing | Catches accidental secrets, debug prints, or stray files before they hit history. |
Minimal .gitignore starter for Python data & AI repos
.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.