# How to Run Code for AI Engineering Lessons in Python, TypeScript, Rust, and Julia

> Learn AI Engineering by running code examples in Python, TypeScript, Rust, and Julia. Execute implementations manually or use the provided script for easy access to all languages.

- Repository: [Rohit Ghumare/ai-engineering-from-scratch](https://github.com/rohitg00/ai-engineering-from-scratch)
- Tags: how-to-guide
- Published: 2026-06-13

---

**The AI Engineering from Scratch curriculum organizes lessons into `phases/<phase-slug>/<lesson-slug>/` directories, each containing a `code/` folder with runnable implementations in Python, TypeScript, Rust, and Julia that you can execute manually or via the [`scripts/lesson_run.py`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/scripts/lesson_run.py) helper.**

The rohitg00/ai-engineering-from-scratch repository is a structured curriculum for learning AI engineering concepts through hands-on implementation. Each lesson ships with complete, runnable code examples in multiple languages to reinforce theoretical concepts with practical execution. Whether you are working through linear algebra foundations or building LLMs from scratch, you can run every lesson locally using the repository's standardized execution patterns.

## Understanding the Repository Structure

Lessons follow a consistent directory convention. Each lesson lives at `phases/<phase-slug>/<lesson-slug>/` and contains a `code/` subdirectory with language-specific implementations.

For example, the *Linear Algebra Intuition* lesson resides at:

```text
phases/01-math-foundations/01-linear-algebra-intuition/
├── code/
│   ├── vectors.py
│   ├── vectors.jl
│   └── tests/
└── docs/
    └── en.md

```

The `code/` directory contains the runnable source files, while `code/tests/` holds unit tests to verify your implementation. The [`scripts/lesson_run.py`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/scripts/lesson_run.py) utility reads each lesson's front-matter from [`docs/en.md`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/docs/en.md) to determine which languages are available and generate the correct execution command.

## Prerequisites and Setup

Start by cloning the repository and installing Python dependencies. While TypeScript, Rust, and Julia rely primarily on standard libraries, Python requires external packages.

Clone the repository:

```bash
git clone https://github.com/rohitg00/ai-engineering-from-scratch.git
cd ai-engineering-from-scratch

```

Install Python dependencies once for the entire curriculum:

```bash
pip install -r requirements.txt

```

This file pins essential packages like `numpy` and `torch`. TypeScript requires no additional installation beyond `npm` (version 8 or higher), which bundles `tsx`. Rust uses only the standard library and requires `rustc`. Julia requires the base language and the `LinearAlgebra` stdlib.

## Running AI Engineering Lessons

### Manual Execution

For quick checks, invoke the interpreter directly on the specific file:

**Python:**

```bash
python phases/01-math-foundations/01-linear-algebra-intuition/code/vectors.py

```

**TypeScript:**

```bash
npx tsx phases/19-capstone-projects/01-terminal-native-coding-agent/code/ts/src/eval.ts

```

**Rust:**

```bash
rustc phases/10-llms-from-scratch/01-tokenizers/code/rust/main.rs -O -o tokenizers
./tokenizers

```

**Julia:**

```bash
julia phases/01-math-foundations/01-linear-algebra-intuition/code/vectors.jl

```

### Using the Lesson Runner Helper

The [`scripts/lesson_run.py`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/scripts/lesson_run.py) script abstracts manual execution. It discovers the `code/` directory, detects available languages, checks for required runtimes, and prints the exact command to run.

Execute the helper with a lesson path:

```bash
python scripts/lesson_run.py phases/01-math-foundations/01-linear-algebra-intuition

```

Output:

```text
python phases/01-math-foundations/01-linear-algebra-intuition/code/vectors.py

```

For TypeScript lessons, the script outputs:

```bash
python scripts/lesson_run.py phases/19-capstone-projects/01-terminal-native-coding-agent

# → npx tsx phases/19-capstone-projects/01-terminal-native-coding-agent/code/ts/src/eval.ts

```

This eliminates the need to remember individual file paths and validates that your system has the required compiler or interpreter installed.

## Language-Specific Execution Guides

### Python Lessons

Python lessons in `phases/*/code/*.py` use standard Python execution. The curriculum is designed **stdlib-first** with minimal external dependencies. Run individual files directly or use the lesson runner.

Example execution:

```bash
python phases/01-math-foundations/01-linear-algebra-intuition/code/vectors.py

```

### TypeScript Lessons

TypeScript implementations require no package installation. The repository uses `tsx` (available via `npx`) to execute `.ts` files directly without compilation steps.

Example execution:

```bash
npx tsx phases/19-capstone-projects/01-terminal-native-coding-agent/code/ts/src/eval.ts

```

### Rust Lessons

Rust lessons use only the standard library. Compile with `rustc` and execute the binary, or use `cargo test` if a [`Cargo.toml`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/Cargo.toml) is present in the lesson directory.

Example execution:

```bash
rustc phases/10-llms-from-scratch/01-tokenizers/code/rust/main.rs -O -o tokenizers
./tokenizers

```

### Julia Lessons

Julia lessons rely on the base language and the `LinearAlgebra` standard library. No additional package management is required.

Example execution:

```bash
julia phases/01-math-foundations/01-linear-algebra-intuition/code/vectors.jl

```

## Verifying Your Setup with Unit Tests

Every lesson includes a `code/tests/` directory with at least five unit tests. Running these validates that implementations work correctly on your machine.

**Python:**

```bash
python -m unittest discover -s phases/01-math-foundations/01-linear-algebra-intuition/code/tests -v

```

**TypeScript:**

```bash
npx jest

```

Jest is already configured as a dev-dependency in the repository root.

**Rust:**

```bash
cargo test

```

Execute this from the lesson directory if a [`Cargo.toml`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/Cargo.toml) is present.

**Julia:**

```bash
julia --project=.

```

Then within the Julia REPL:

```julia
using Test
include("code/tests/runtests.jl")

```

## Installing Generated Skills (Optional)

After completing lessons, artifacts such as prompts, skills, agents, or MCP servers appear in `phases/<phase-slug>/<lesson-slug>/outputs/`. Load all artifacts into your local environment using the convenience script:

```bash
python3 scripts/install_skills.py

```

This installs skills discovered throughout the curriculum, including the interactive `/find-your-level` skill located at [`.claude/skills/find-your-level/SKILL.md`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/.claude/skills/find-your-level/SKILL.md).

## Summary

- **Repository structure**: Lessons reside in `phases/<phase-slug>/<lesson-slug>/code/` with implementations in Python, TypeScript, Rust, and Julia.
- **Execution methods**: Run files directly with language interpreters or use `python scripts/lesson_run.py <lesson-path>` to auto-generate commands.
- **Dependencies**: Python requires `pip install -r requirements.txt`; other languages use standard libraries only.
- **Verification**: Each lesson includes `code/tests/` with unit tests runnable via `unittest`, `jest`, `cargo test`, or Julia's `Test` package.
- **Artifacts**: Install generated skills using `python3 scripts/install_skills.py` after completing lessons.

## Frequently Asked Questions

### How do I know which languages are available for a specific lesson?

The [`scripts/lesson_run.py`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/scripts/lesson_run.py) helper detects available languages by reading the lesson's front-matter in [`docs/en.md`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/docs/en.md). When you run the script with a lesson path, it lists only the languages present in that lesson's `code/` directory and prints the corresponding execution command.

### Can I run the curriculum without installing Python dependencies?

Yes, but only for TypeScript, Rust, and Julia lessons. These implementations use only standard libraries. However, Python lessons require the packages listed in [`requirements.txt`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/requirements.txt) (such as `numpy` and `torch`) to execute the mathematical and neural network implementations.

### What should I do if the lesson runner reports a missing runtime?

The [`lesson_run.py`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/lesson_run.py) script checks for the presence of required tools (`python`, `npx`, `rustc`, `julia`) before generating commands. If a runtime is missing, install the language toolchain for your operating system. Python requires version 3.x, Node.js 18+ for TypeScript, Rust 1.70+ for Rust lessons, and Julia 1.9+ for Julia implementations.

### How do I jump to a lesson appropriate for my current skill level?

Use the interactive "find-your-level" skill by running the install script `python3 scripts/install_skills.py`, then invoke the skill at [`.claude/skills/find-your-level/SKILL.md`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/.claude/skills/find-your-level/SKILL.md). This skill maps your existing knowledge to the appropriate phase in the curriculum, allowing you to skip foundational material or start with advanced topics like LLM implementation or agent engineering.