# Allowed Julia Standard Library Dependencies in AI Engineering from Scratch

> Discover the four allowed Julia standard library dependencies Random Statistics LinearAlgebra and Printf in AI Engineering from Scratch. Keep lessons self-contained and focused.

- Repository: [Rohit Ghumare/ai-engineering-from-scratch](https://github.com/rohitg00/ai-engineering-from-scratch)
- Tags: api-reference
- Published: 2026-09-11

---

**The ai-engineering-from-scratch curriculum permits only four Julia standard library modules—`Random`, `Statistics`, `LinearAlgebra`, and `Printf`—to ensure lessons remain self-contained and focused on core language fundamentals.**

The open-source educational repository `rohitg00/ai-engineering-from-scratch` maintains a strict dependency allowlist across all programming language tracks. For the Julia implementation path, the project explicitly limits learners to a specific set of **allowed Julia standard library dependencies**, eliminating external package requirements while preserving the functionality needed for fundamental AI algorithms.

## The Definitive Allowlist for Julia Standard Library Dependencies

According to the [`AGENTS.md`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/AGENTS.md) file in the repository root, the Dependencies table enumerates exactly which Julia modules are permitted for use throughout the curriculum:

- **`Random`** – Pseudo-random number generation for weights initialization and data sampling
- **`Statistics`** – Basic statistical functions including mean and standard deviation
- **`LinearAlgebra`** – Matrix operations, eigenvalue decomposition, and linear transformations
- **`Printf`** – Formatted output for debugging and results display

These modules are part of the base Julia distribution, requiring no `Pkg.add()` calls or external dependencies.

## Core Capabilities of Each Allowed Module

The four permitted standard library modules cover the essential mathematical primitives required for implementing neural networks and statistical algorithms from scratch.

### Random Number Generation

The `Random` module provides utilities for generating reproducible random sequences, critical for initializing model weights and creating synthetic datasets.

```julia
using Random

# Set seed for reproducibility

Random.seed!(123)

# Generate uniform random float between 0 and 1

rand_float = rand()

# Generate vector of 5 random integers from 1 to 10

rand_ints = rand(1:10, 5)

```

### Statistical Operations

`Statistics` delivers fundamental descriptive statistics necessary for computing loss functions and analyzing dataset distributions.

```julia
using Statistics

data = [23.0, 45.0, 67.0, 89.0, 12.0]

# Calculate mean

μ = mean(data)

# Calculate standard deviation

σ = std(data)

```

### Linear Algebra Operations

The `LinearAlgebra` module supplies matrix multiplication, transposition, and eigenvalue decomposition—core operations for forward propagation and principal component analysis.

```julia
using LinearAlgebra

# Create random 3x3 matrices

A = rand(3, 3)
B = rand(3, 3)

# Matrix multiplication

C = A * B

# Eigenvalue decomposition

eigenvalues = eigen(A).values
eigenvectors = eigen(A).vectors

```

### Formatted Output

`Printf` enables C-style formatted printing for displaying training metrics and final results with specific precision.

```julia
using Printf

# Display metrics with 2 decimal places

@printf "Loss: %.4f | Accuracy: %.2f%%\n" 0.123456 98.5

```

## Why the Curriculum Restricts Julia Standard Library Dependencies

The `rohitg00/ai-engineering-from-scratch` project enforces this limited allowlist for three specific architectural reasons:

**Educational Clarity** – Restricting dependencies forces learners to implement algorithms using only language primitives and basic mathematical operations, revealing the underlying mechanics of machine learning rather than hiding them behind high-level library abstractions.

**Reproducibility** – Because all allowed modules ship with the standard Julia distribution, any lesson code located in `phases/*/*/code/main.jl` executes immediately on any system with Julia installed, eliminating version conflicts or missing package errors.

**Curriculum Consistency** – The "stdlib-first" philosophy applies uniformly across all language tracks in the repository, enabling direct comparison of implementations while maintaining identical pedagogical constraints.

## Enforcement and Verification

The repository implements automated checks to ensure compliance with the **allowed Julia standard library dependencies**.

The source of truth resides in [`AGENTS.md`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/AGENTS.md), where the Dependencies table explicitly lists the four permitted modules. Every lesson submission must import only these modules in its `code/main.jl` file within the `phases/*/*/code/` directory structure.

Continuous integration pipelines scan the `code/tests/` directories to detect unauthorized imports. If a learner attempts to use external packages like `Flux.jl` or `DataFrames.jl`, or even non-allowed standard library modules like `Sockets` or `Dates`, the CI checks fail immediately, enforcing the curriculum boundaries.

## Summary

- The `rohitg00/ai-engineering-from-scratch` repository permits only four Julia modules: `Random`, `Statistics`, `LinearAlgebra`, and `Printf`.
- These **allowed Julia standard library dependencies** are defined in the [`AGENTS.md`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/AGENTS.md) file and cover random generation, statistics, linear algebra, and formatted printing.
- All lesson code must reside in `phases/*/*/code/main.jl` and use only these modules to ensure portability and educational focus.
- Automated tests in `code/tests/` verify compliance, rejecting any code with external or non-allowed standard library dependencies.

## Frequently Asked Questions

### Can I use external packages like Flux.jl or DataFrames.jl in my Julia solutions?

No. The curriculum strictly prohibits any external package dependencies. All solutions must implement algorithms using only the four allowed standard library modules—`Random`, `Statistics`, `LinearAlgebra`, and `Printf`—as specified in [`AGENTS.md`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/AGENTS.md). This constraint ensures you understand the underlying mathematical operations rather than relying on high-level abstractions.

### What happens if my code imports a non-allowed Julia module?

If your `main.jl` file imports modules outside the allowlist—such as `Dates`, `Sockets`, or external packages—the repository's continuous integration checks in `code/tests/` will automatically reject your submission. The CI pipeline scans for unauthorized imports to maintain curriculum integrity across all `phases/*/*/code/` directories.

### Why are only four standard library modules permitted for Julia?

The restriction to `Random`, `Statistics`, `LinearAlgebra`, and `Printf` represents a deliberate pedagogical choice to cover the mathematical foundations of AI—random initialization, statistical loss calculation, matrix operations, and output formatting—while keeping the environment lightweight. These modules provide sufficient functionality for implementing neural networks from scratch without introducing the complexity of larger standard library components or external ecosystems.

### How do I verify my lesson code uses only allowed dependencies before submitting?

Review your `main.jl` file to ensure all `using` and `import` statements reference only `Random`, `Statistics`, `LinearAlgebra`, or `Printf`. Check against the definitive list in [`AGENTS.md`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/AGENTS.md). You can also run the repository's local test suite, which mirrors the CI checks in `code/tests/`, to validate that no unauthorized modules are loaded during execution.