mirror of
https://github.com/harvard-edge/cs249r_book.git
synced 2026-11-14 18:24:37 -06:00
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.
49 lines
1.6 KiB
Python
Executable File
49 lines
1.6 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
"""
|
|
Setup script to install binder CLI in virtual environment
|
|
This allows using 'binder' command without './' when venv is active
|
|
"""
|
|
|
|
import os
|
|
import sys
|
|
import subprocess
|
|
from pathlib import Path
|
|
|
|
def main():
|
|
"""Install binder CLI in development mode"""
|
|
project_root = Path(__file__).parent.parent # binder/ -> repository root
|
|
|
|
print("🔧 Setting up binder CLI in virtual environment...")
|
|
|
|
# Check if we're in a virtual environment
|
|
if not hasattr(sys, 'real_prefix') and not (hasattr(sys, 'base_prefix') and sys.base_prefix != sys.prefix):
|
|
print("⚠️ Warning: Not in a virtual environment")
|
|
print(" Consider activating your venv first: source .venv/bin/activate")
|
|
response = input(" Continue anyway? (y/N): ")
|
|
if response.lower() != 'y':
|
|
print("❌ Setup cancelled")
|
|
return 1
|
|
|
|
try:
|
|
# Install in development mode
|
|
subprocess.run([
|
|
sys.executable, "-m", "pip", "install", "-e", "."
|
|
], cwd=project_root, check=True)
|
|
|
|
print("✅ Binder CLI installed successfully!")
|
|
print()
|
|
print("📋 You can now use:")
|
|
print(" binder help # Global command (when venv active)")
|
|
print(" ./binder/binder help # Local script (always works)")
|
|
print()
|
|
print("🎯 Both commands do the same thing - use whichever you prefer!")
|
|
|
|
return 0
|
|
|
|
except subprocess.CalledProcessError as e:
|
|
print(f"❌ Installation failed: {e}")
|
|
return 1
|
|
|
|
if __name__ == "__main__":
|
|
sys.exit(main())
|