Allowed Dependencies Per Language in the AI Engineering Curriculum
The curriculum enforces a "stdlib-first" policy that permits only five specific Python packages, four TypeScript libraries, and standard-library-only development for Rust and Julia.
The rohitg00/ai-engineering-from-scratch repository maintains strict dependency boundaries to ensure learners implement algorithms from scratch rather than relying on black-box abstractions. Understanding the allowed dependencies per language is critical for contributors submitting new lessons, as any deviation from the approved list in AGENTS.md requires formal justification and curriculum maintainer approval.
Approved Dependencies by Language
The dependency allowlist is explicitly defined in the Dependencies table within AGENTS.md. Each language tier balances educational utility with the need to minimize external complexity.
Python: Scientific Computing Stack
Python lessons may import from the standard library plus five approved third-party packages:
numpy– Numerical arrays and linear algebratorch– Tensor computation and automatic differentiationh5py– HDF5 binary data formatzstandard– Zstd compressionsafetensors– Secure tensor serialization
These packages are permitted because they provide essential data structures (tensors, arrays) while still requiring the learner to implement the algorithmic logic manually.
TypeScript: Web Framework and Validation
TypeScript lessons are restricted to the standard library plus four specific packages:
hono– Lightweight web frameworkzod– Schema validationws– WebSocket implementation (only when WebSocket functionality is explicitly required)@hono/node-server– Node.js adapter for Hono
This constraint ensures that web-based AI demos remain lightweight and do not pull in heavy framework ecosystems that obscure the underlying networking logic.
Rust: Standard Library Only
Rust lessons must use only the standard library, compiled as single-file programs with rustc --edition 2021. No external crates from crates.io are permitted.
This restriction forces learners to implement data structures (vectors, hash maps) and algorithms manually, reinforcing low-level systems understanding before introducing async runtimes or ML frameworks.
Julia: Core Stdlib Modules
Julia lessons are limited to the standard library, specifically these four modules:
Random– Pseudorandom number generationStatistics– Statistical functionsLinearAlgebra– Matrix operations and factorizationsPrintf– Formatted printing
Unlike Python, Julia’s standard library is already optimized for numerical computing, eliminating the need for external dependencies while maintaining performance.
Architectural Rationale for Dependency Restrictions
The curriculum maintains these boundaries for four specific pedagogical and technical reasons:
Pedagogical Clarity – Limiting dependencies ensures that lesson code demonstrates the complete data flow of an algorithm (e.g., a neural-network forward pass) without hiding implementation details behind high-level package abstractions.
Reproducibility – A small, well-defined set of packages minimizes version conflicts across the many independent lesson repositories, ensuring that code written today compiles and runs identically tomorrow.
Portability – The curriculum targets environments that may lack internet access for pip or npm installs. The stdlib-only rule for Rust and Julia guarantees that code compiles out-of-the-box with only the language toolchain installed.
Consistency – The AGENTS.md table acts as a single source of truth; the scripts/audit_lessons.py CI script enforces compliance automatically, preventing dependency drift across the codebase.
Code Implementation Examples
These snippets illustrate the exact import statements and patterns permitted for each language tier.
Python: Using NumPy for Tensor Operations
import numpy as np
def softmax(x: np.ndarray) -> np.ndarray:
e_x = np.exp(x - np.max(x))
return e_x / e_x.sum(axis=0)
TypeScript: Using Hono for Web Endpoints
import { Hono } from 'hono';
const app = new Hono();
app.get('/ping', (c) => c.text('pong'));
export default app;
Rust: Pure Stdlib Matrix Multiplication
fn matrix_mul(a: &Vec<Vec<f64>>, b: &Vec<Vec<f64>>) -> Vec<Vec<f64>> {
let n = a.len();
let m = b[0].len();
let p = b.len();
let mut result = vec![vec![0.0; m]; n];
for i in 0..n {
for j in 0..m {
for k in 0..p {
result[i][j] += a[i][k] * b[k][j];
}
}
}
result
}
Julia: Using Random for Sampling
using Random
function sample_normal(mu, sigma, n)
rng = MersenneTwister()
return randn(rng, n) .* sigma .+ mu
end
Enforcement and Key Files
The curriculum uses automated tooling to maintain dependency discipline. These files govern the approval process:
AGENTS.md– Defines the canonical dependency allowlist and project conventions.scripts/audit_lessons.py– CI script that parses lesson files and validates imports against the approved list.phases/*/*/docs/en.md– Individual lesson front-matter that must declare its target language, which CI checks against actual imports.
If a lesson requires a package not on the allowlist, maintainers must update the AGENTS.md table and provide pedagogical justification for the exception.
Summary
- The AI Engineering curriculum follows a "stdlib-first" philosophy documented in
AGENTS.md. - Python permits five packages:
numpy,torch,h5py,zstandard, andsafetensors. - TypeScript permits four packages:
hono,zod,ws, and@hono/node-server. - Rust and Julia are restricted to their respective standard libraries only.
- The
scripts/audit_lessons.pyCI script enforces compliance automatically.
Frequently Asked Questions
Can I use external packages not on the allowlist if they simplify the lesson?
No. Any package outside the approved list violates the curriculum's pedagogical contract. If you believe a specific dependency is essential, you must submit a justification to the maintainers and update the AGENTS.md table before the CI will pass your lesson.
Why is Rust restricted to the standard library while Python allows external packages?
Rust's standard library provides sufficient systems-level primitives (vectors, iterators, concurrency) to implement core AI algorithms from scratch, whereas Python's standard library lacks efficient numerical arrays. The restriction ensures Rust learners master ownership and borrowing without macro-heavy framework abstractions.
How does the curriculum handle version conflicts for approved TypeScript packages?
All approved packages are locked to specific versions in the root package.json or lesson-level lockfiles. The scripts/audit_lessons.py script verifies that only the specified versions are imported, ensuring reproducibility across the distributed lesson repositories.
What Julia standard library modules are explicitly permitted for linear algebra?
The curriculum explicitly permits LinearAlgebra, Random, Statistics, and Printf from the Julia standard library. These modules provide BLAS-backed matrix operations and statistical sampling without requiring external packages like Flux.jl or MLJ.jl.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →