Skip to content
Courses/Aulafy foundations/Modern Python with uv

Modern Python with uv

uv simplifies Python for AI projects: it installs versions, creates environments, locks dependencies, and avoids many classic pip and venv problems.

Install uv

For new local AI projects, uv is comfortable because it combines several jobs: package management, virtual environments, and Python versions. That lowers friction when moving from one lesson to another.

TerminalCode
curl -LsSf https://astral.sh/uv/install.sh | sh

# Windows PowerShell
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"

Create a clean project

TerminalCode
uv init aulafy-practice
cd aulafy-practice
uv python install 3.12
uv venv
source .venv/bin/activate
uv add rich requests python-dotenv

On Windows, activate the environment with .venv\Scripts\activate. The important part is that each project has its own environment and declared dependencies.

Minimum Python for AI

  • Read and write JSON, Markdown, CSV, and plain text.
  • Write small functions with type hints.
  • Use try/except for network, file, and model errors.
  • Understand basic async when an app calls APIs or slow tools.
TerminalCode
import json
from pathlib import Path

def load_json(path: str) -> dict:
    return json.loads(Path(path).read_text(encoding="utf-8"))

config = load_json("config.json")
print(config.get("model", "no model"))

Aulafy judgment

Start with plain Python. Before adding LangChain, LangGraph, LlamaIndex, or large frameworks, make sure you can make a call, save a trace, and reproduce the result.