Files
Vijay Janapa Reddi 14ca66d2e9 Rename bindery/ to binder/ and run the CLI by its real path
The toolchain folder is now binder/, and the root ./binder symlink is gone.
The command is ./binder/binder: a plain path to the script, with no link and
no install step. Every invocation moved with it: pre-commit entries, workflow
steps, the VS Code extension's command palette, help text, and docs.

- bindery/ paths and bindery.* imports, including the chapter code cells
  that import binder.tools.figures, now name binder/.
- Binder (mybinder.org) reads its configuration from a root binder/ folder
  and refuses to build when binder/ and .binder/ both exist. .binder/postBuild
  and .binder/requirements.txt move into binder/, so the TinyTorch "Launch
  Binder" buttons keep working; binder/README.md records which file names the
  toolchain must not use there.
- contributors/projects.json still pointed the book's contributor record at
  publishing/; it now names binder/, where that .all-contributorsrc lives.
- The margin-figure reader-link audit report linked its 222 figures through
  the retired quarto/ tree; the links now resolve under books/.

The hooks reformatted hidden Python cells and trimmed whitespace in the
Volume II chapters whose figure imports this rename touches.

Checks: ./binder/binder check cli passes (contract and canonical hooks),
binder.tools.figures imports, and every workflow YAML file parses.

binder test suite, excluding the four modules that cannot import mlsysim
through the root symlink (fixed separately): 7 failed, 346 passed.

The GitHub repository variables BOOK_ROOT, BOOK_TOOLS, BOOK_DEPS, and
BOOK_DOCKER still name the retired book/ layout and must change when this
reaches origin.
2026-09-10 15:26:07 +02:00

78 lines
2.5 KiB
Bash
Executable File

#!/bin/bash
# MLSysBook Setup Script
# This script sets up the development environment for new contributors
set -e # Exit on any error
echo "🚀 Setting up MLSysBook development environment..."
# Check if Python is installed
if ! command -v python3 &> /dev/null; then
echo "❌ Python 3 is required but not installed. Please install Python 3.9+ first."
exit 1
fi
# Check Python version
python_version=$(python3 -c 'import sys; print(".".join(map(str, sys.version_info[:2])))')
echo "✅ Python $python_version detected"
# Create virtual environment if it doesn't exist
if [ ! -d ".venv" ]; then
echo "📦 Creating virtual environment..."
python3 -m venv .venv
fi
# Activate virtual environment
echo "🔧 Activating virtual environment..."
source .venv/bin/activate
# Upgrade pip
echo "⬆️ Upgrading pip..."
pip install --upgrade pip
# Install dependencies
echo "📚 Installing dependencies..."
pip install -r tools/dependencies/requirements.txt
# Install pre-commit hooks
echo "🔗 Installing pre-commit hooks..."
pre-commit install
# Check for GitHub CLI
echo "🔍 Checking for GitHub CLI..."
if ! command -v gh &> /dev/null; then
echo "📦 Installing GitHub CLI..."
if [[ "$OSTYPE" == "darwin"* ]]; then
# macOS
if command -v brew &> /dev/null; then
brew install gh
else
echo "❌ Homebrew is required to install GitHub CLI on macOS"
echo " Install Homebrew first: https://brew.sh"
echo " Then run: brew install gh"
fi
elif [[ "$OSTYPE" == "linux-gnu"* ]]; then
# Linux
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
sudo apt update
sudo apt install gh
else
echo "⚠️ Please install GitHub CLI manually: https://cli.github.com/"
fi
else
echo "✅ GitHub CLI already installed"
fi
echo ""
echo "🎉 Setup complete! Your development environment is ready."
echo ""
echo "📋 Next steps:"
echo " 1. Activate the virtual environment: source .venv/bin/activate"
echo " 2. Authenticate with GitHub: gh auth login"
echo " 3. Run pre-commit checks: pre-commit run --all-files"
echo " 4. Start developing!"
echo ""
echo "📚 For more information, see DEPENDENCIES.md"