Module · AI Engineer
Python
The working language of AI engineering.
TOPIC 01
Your First Python Script
Lay out a Python project on disk, pin a dependency and make it a real git repository.
Your First Python Script
Every AI engineer starts the same way: a folder, a script, a pinned dependency and a git repo. Before you touch a model API, you need the muscle memory of turning an empty home directory into a real project.
What you'll practice
- Write Your First Script — guided · beginner
- Lay Out a Python Project — practice · beginner
A command you'll meet
echo httpx==0.27.0 > ~/ai-lab/requirements.txtOpen any task below to get the full step-by-step walkthrough — every command is explained, and the lab validator checks what you actually built.
Hands-On Tasks in This Topic (2)
Write Your First Script
Create the ~/ai-lab directory, write a tiny Python script and pin a dependency in a requirements.txt. In a real terminal you would run these files with the python command — here the focus is on the files themselves.
Lay Out a Python Project
Build the classic Python project skeleton — src/ for code, tests/ for tests, a README — and turn it into a git repository with an initial commit. This is the shape nearly every real Python project takes.
TOPIC 02
Testing & Typing Your AI Code
Tests that catch a broken prompt call, and types that make the shape of a message obvious.
What you'll practice
- Write a Pytest Suite — practice · intermediate
- Type Your Message Models — guided · beginner
A command you'll meet
pytest -qYou cannot prompt your way out of a broken function. Open the task below for the full walkthrough.
Hands-On Tasks in This Topic (2)
Write a Pytest Suite
The part of your AI code that is not a model call is ordinary code, and ordinary code deserves ordinary tests. Write a test for the prompt builder and a pytest configuration.
Type Your Message Models
A chat message is a small, fixed shape - and the shape is exactly where the bugs hide. Model it as a dataclass with type hints.