Commit Graph

112 Commits

Author SHA1 Message Date
Vijay Janapa Reddi
d7d288dace Fix UnicodeDecodeError on Windows in tito module complete (fixes #1184)
Add encoding='utf-8' and errors='replace' to subprocess.run() calls in
workflow.py so unit and integration test output decode correctly on
Windows (cp1252) when output contains UTF-8 characters.

Co-authored-by: Pratham-ja <114498234+Pratham-ja@users.noreply.github.com>
2026-02-21 09:38:08 -05:00
Vijay Janapa Reddi
672a35335f feat(vscode-ext, tito): make extension a thin client over Tito CLI
The VS Code extension no longer implements any business logic — every
capability (module discovery, path resolution, system info, builds,
tests, clean) lives in Tito CLI commands. The extension is a pure UI
shell that delegates via `python3 -m tito.main`.

Tito CLI additions:
- `module list --json` for machine-readable module discovery
- `module path <num> --notebook|--source|--about` for file resolution
- `system info --json` for environment info
- `dev build html|serve|pdf|paper` wrapping make targets
- `dev clean [all|site]` wrapping make clean
- Banner suppression for --json and module path output

Extension hardening:
- Centralized CLI integration in utils/tito.ts (single TITO_CMD constant,
  callTito, callTitoJson, titoTerminalCommand, isTitoAvailable, log/logError)
- Replaced all silent catch{} blocks with logged errors and user feedback
- Module tree shows error/empty states with actionable Setup/Health buttons
- Info tree shows "Tito CLI unavailable" when CLI is unreachable
- Removed all setTimeout refresh hacks — file watcher on .tito/progress.json
  is the sole refresh mechanism
- Exit code tracking via onDidEndTerminalShellExecution
- Tito availability pre-flight check on activation
- BUILD_OUTPUTS constants for build artifact paths
- Zero execSync calls outside tito.ts, zero hardcoded command strings
2026-02-17 10:08:00 -05:00
Vijay Janapa Reddi
173f28f88d fix(tinytorch): clean up Windows install fix comments from PR #1169
Polish the contributor's Windows fix with proper comments explaining
the Microsoft Store alias issue and WinError 32 file lock. Move
is_windows check closer to usage site for clarity.
2026-02-13 11:39:28 -05:00
Adil Mubashir Chaudhry
f2975daa67 Fix Windows install issues
- Prefer python over python3 in Git Bash to avoid Microsoft Store alias and incorrect venv paths
- Skip TinyTorch self-reinstall on Windows if already installed (prevents WinError 32 file lock)
2026-02-12 14:47:35 +05:00
Vijay Janapa Reddi
25fc9e4848 fix(tito): resolve Jupyter kernel mismatch causing ModuleNotFoundError (#1147)
Students hit "No module named 'tinytorch.core.tensor'" in notebooks because
the Jupyter kernel used a different Python than where tinytorch was installed.

- setup: install ipykernel + nbdev, register named kernel during tito setup
- health: add Notebook Readiness checks (import, kernel, Python match)
- export: verify exported file exists and has content (fail loudly)
- Windows: add get_venv_bin_dir() helper for cross-platform venv paths
2026-02-04 10:24:37 -05:00
AndreaMattiaGaravagno
5f6a8468f3 fix(tito-milestone): align bold cyan frame and correct "Press Enter" color 2026-02-03 12:24:18 +01:00
Vijay Janapa Reddi
bb5dd7a9f6 fix(export): use nbdev Python API instead of CLI for reliable export
The nbdev_export CLI was not reading settings.ini correctly in CI,
causing exports to silently fail. Using nbdev.export.nb_export()
Python API directly with explicit lib_path ensures exports work
reliably regardless of environment.
2026-01-29 14:28:40 -05:00
Vijay Janapa Reddi
2ec60a6f5c fix(export): use python -m nbdev.export instead of nbdev_export command
The nbdev_export command wasn't in PATH in CI. Using sys.executable
with -m nbdev.export ensures we use the same Python environment that's
running tito, which is more reliable across different environments.

Fixed in:
- tito/commands/dev/export.py (both _export_all_modules and _run_nbdev_export)
- tito/commands/module/workflow.py (_export_notebook)
2026-01-29 14:19:26 -05:00
Vijay Janapa Reddi
2546b54bba fix(export): handle running from tinytorch directory
The directory check was looking for tinytorch/tinytorch/__init__.py
when running from the tinytorch directory (as CI does). Fixed to check
for either repo root or tinytorch project directory structure.
2026-01-29 13:53:22 -05:00
Vijay Janapa Reddi
46d633d3cd fix(ci): show full export error output for debugging
Increased error output from 100 to 500 chars and show both stdout
and stderr to help diagnose CI export failures.
2026-01-29 13:51:58 -05:00
Vijay Janapa Reddi
316bdae031 Merge dev: user journey test + export bug fix 2026-01-28 12:42:30 -05:00
Vijay Janapa Reddi
c46beda3e5 feat(cli): better error message for invalid commands 2026-01-28 12:41:58 -05:00
Vijay Janapa Reddi
98c5415a5a fix: skip sync prompt in CI + increase milestone timeout
- Skip "sync to profile" prompt when not in interactive terminal
  (was hanging in CI waiting for input that never comes)
- Increase milestone timeout from 180s to 300s for heavy milestones
  (CNN and Transformer training can take 2-3 minutes on CI)
2026-01-28 11:54:23 -05:00
Vijay Janapa Reddi
a70c724a02 fix: export failure now blocks progress + add user journey test
Bug Fix:
- Export failures now return early in module complete, preventing
  progress from being updated when export fails. This fixes the issue
  where students could start Module 02 even though tensor.py was
  never exported.

New --user-journey test:
- Simulates exact student flow: module start --no-jupyter → module complete
- Runs milestones at natural unlock checkpoints (not all at end)
- Milestone checkpoints: after modules 03, 08, 09, 13, 19
- Explicit step-by-step output for easy CI debugging

New --no-jupyter flag:
- Added to 'tito module start' for CI/testing
- Creates notebook but skips opening Jupyter

Ref: https://github.com/harvard-edge/cs249r_book/discussions/1147
2026-01-28 09:28:15 -05:00
Vijay Janapa Reddi
aefbedbe30 fix(tinytorch): add PYTHONIOENCODING=utf-8 for Windows emoji support
Fixes encoding issues on Windows where emoji/unicode output would fail.
Thanks @lalalostcode for reporting!

See: https://github.com/harvard-edge/cs249r_book/discussions/1145
2026-01-27 13:20:37 -05:00
Vijay Janapa Reddi
64ea816f85 fix(console): disable legacy Windows console for emoji support
Rich's legacy Windows console rendering uses cp1252 encoding which
doesn't support emoji characters. Setting legacy_windows=False makes
Rich use ANSI escape codes instead, which work in modern Windows
Terminal, Git Bash, and most terminal emulators.
2026-01-26 08:56:22 -05:00
Vijay Janapa Reddi
223ce01d66 fix(tests): skip slow milestone tests in unit test runs
Unit tests now skip @pytest.mark.slow tests to avoid CI timeouts.
Milestone tests explicitly run all tests (including slow ones).

This ensures:
- Unit tests run quickly (~43s instead of timing out)
- Milestone tests still validate full milestone execution
- CI passes stages 1-5 reliably
2026-01-24 19:31:02 -05:00
Vijay Janapa Reddi
26a362ec2d style(milestones): minor formatting fixes in milestone files
- Fixed ASCII art alignment in xor_crisis.py
- Fixed table alignment in rumelhart_tinydigits.py
- Fixed table alignment in generation_speedup.py
2026-01-24 19:04:22 -05:00
Vijay Janapa Reddi
7169ad6529 fix(ci): remove milestone stage and fix interactive prompt in CI
- Remove Stage 6 (milestone tests) from CI workflow since test files were
  removed as redundant with integration tests
- Renumber Stage 7 (release) to Stage 6
- Update summary job to remove milestone references
- Fix _trigger_submission() to skip interactive prompts in CI mode
  by checking CI, GITHUB_ACTIONS env vars and stdin.isatty()

The milestone demo scripts remain available for student use via
'tito milestone run', but are no longer run as automated tests.
2026-01-24 14:30:22 -05:00
Vijay Janapa Reddi
975c92a1c6 fix(cli): resolve Rich markup rendering in module completion message
Text.append() does not interpret Rich markup - it treats strings as
literal text. Split the markup into separate append calls with proper
style parameters so the 'Next: tito module start XX' hint renders
correctly instead of showing literal [bold cyan] tags.
2026-01-24 09:29:51 -05:00
Vijay Janapa Reddi
e19be54703 debug(tests): show import errors in CI output for debugging 2026-01-23 17:15:52 -05:00
Vijay Janapa Reddi
918f72e6a2 fix(tests): add PYTHONPATH to pytest subprocess for CI imports
The _run_pytest method was missing PYTHONPATH in the subprocess
environment, causing tinytorch imports to fail in CI where the
package isn't installed system-wide.
2026-01-23 17:11:21 -05:00
Vijay Janapa Reddi
42bc991d75 fix(tests): add PYTHONPATH to inline test subprocess
Source files like src/02_activations/02_activations.py import from
tinytorch.core.tensor. When running these as subprocesses, the Python
path needs to include the project root so the imports resolve correctly.

This was causing CI to fail at module 02 because it couldn't find
tinytorch.core.tensor even though module 01 had exported it.
2026-01-23 16:56:17 -05:00
Vijay Janapa Reddi
102eacaaa2 feat(cli): implement tito module complete --all
- Added complete_all_modules() method that iterates through all modules
- Runs tests + export for each module in sequence (01 → 20)
- Stops on first failure for fail-fast behavior
- Skips modules without notebooks (shows as 'skipped')
- Useful for CI validation and students exporting all work

Distinction from dev export --all:
- dev export --all: Rebuilds from src/ (overwrites student notebooks)
- module complete --all: Tests + exports existing notebooks (safe for students)
2026-01-23 16:52:36 -05:00
Vijay Janapa Reddi
c4c64ebc9a fix(ci): use dev export --all for package builds instead of module complete
- _build_package now uses 'tito dev export --all' which properly:
  1. Converts src/*.py to modules/*.ipynb (jupytext)
  2. Exports to tinytorch/core/ (nbdev_export)

- Fixes issue where 'module complete --all' didn't iterate through modules
- Added CI streaming output for better visibility during builds
- Each CI stage that needs the package will build it independently
2026-01-23 15:00:34 -05:00
Vijay Janapa Reddi
a44e76131b fix(ci): inline tests must export notebooks before module complete
The inline tests were calling 'module complete' directly, but the notebook
doesn't exist until 'dev export' creates it from src/.

Now the flow is:
1. tito dev export <module>  - Creates notebook from src/
2. tito module complete <module> - Runs tests and exports to core/

This matches the proper progressive build workflow.
2026-01-23 14:55:15 -05:00
Vijay Janapa Reddi
7f01c24f09 feat: add 'tito system reset' command for pristine state reset
New command that resets TinyTorch to a clean state:
- Clears modules/ directory (all numbered module folders)
- Clears tinytorch/core/ (all .py except __init__.py)
- Optionally resets progress tracking (--keep-progress to skip)

Usage:
  tito system reset           # Interactive confirmation
  tito system reset --force   # Skip confirmation
  tito system reset --ci      # CI mode with exit codes
  tito system reset --keep-progress  # Keep completion history

This is useful for:
- Testing fresh install experience
- CI/CD pipeline resets
- Starting over with a clean slate
2026-01-23 14:54:07 -05:00
Vijay Janapa Reddi
03417e2101 fix(ci): use 'module complete --all' to fully build package before tests
The previous approach used 'dev export --all' which only exports notebooks
but doesn't run inline tests or copy code to tinytorch/core/.

Now uses 'module complete --all' which:
1. Exports notebooks from src/ to modules/
2. Runs inline tests in each module
3. Copies tested code to tinytorch/core/

This ensures 'from tinytorch import Tensor' works in unit tests.
2026-01-23 14:52:09 -05:00
Vijay Janapa Reddi
e7fc890842 fix(ci): proper exit codes and error counting in test output
Critical fixes:
1. bin/tito now uses sys.exit(main()) to propagate exit codes
   - Previously the exit code was discarded, causing CI to pass even on failures

2. Collection errors are now counted and displayed
   - 'ERROR tests/...' lines (collection failures) are now tracked
   - Summary shows 'X errors, Y failed, Z passed' for clarity

Without these fixes, CI stages could show green even when tests failed.
2026-01-23 14:51:26 -05:00
Vijay Janapa Reddi
840eae5178 feat(ci): add verbose streaming output for all pytest-based tests
In CI mode, all test types (unit, CLI, integration, E2E, milestone) now show:
- Header with test type and path
- Per-test progress as they run (✓ PASSED / ✗ FAILED)
- Summary footer with counts

This makes CI logs much more informative - you can see exactly which tests
are running and their status in real-time.
2026-01-23 14:40:26 -05:00
Vijay Janapa Reddi
64444e41d3 Merge remote-tracking branch 'origin/dev' into feature/tinytorch 2026-01-23 14:31:09 -05:00
Vijay Janapa Reddi
e1880011ff feat(ci): add verbose per-module output for inline tests
In CI mode, inline tests now show:
- Header with total module count
- Per-module progress: [1/20] Module 01: tensor... ✓ PASSED
- Error details if a module fails
- Summary footer with result

This makes CI logs much more informative for debugging.
2026-01-23 14:21:17 -05:00
Didier Durand
72adaae229 [Doc]: fixing some typos (#1133) 2026-01-23 14:00:43 -05:00
Vijay Janapa Reddi
71b754037a feat: apply stashed improvements after merge
Key improvements from local development:
- conftest.py: Add package export validation before tests run
- preflight.py: Stricter Tensor import check (fail if None)
- 06_autograd.py: Set requires_grad manually in tests (progressive disclosure)
- 08_training.py, 09_convolutions.py: Add enable_autograd() calls
- install.sh: Environment variable overrides for testing
- nbdev.py: Fix import path for DevExportCommand

Also syncs CI/publish workflows from origin/dev
2026-01-23 13:31:27 -05:00
Vijay Janapa Reddi
65f67c94e6 Merge origin/dev into feature/tinytorch
Resolve conflicts:
- .github/workflows/contributors/generate_main_readme.py: take dev's width_pct parameter
- .vscode/settings.json: keep worktree-specific orange Peacock color
2026-01-23 13:29:17 -05:00
Vijay Janapa Reddi
54f91331af fix(docs): replace non-existent tito src with tito dev export
The `tito src` command was never implemented. All documentation
references have been updated to use the correct commands:

- `tito src export` → `tito dev export`
- `tito src test` → `tito dev test`

Also removed 'src' from developer_commands list in main.py since
it doesn't exist as a registered command.
2026-01-23 13:21:34 -05:00
Vijay Janapa Reddi
a8d6f1de55 refactor(cli): update dev command group for new test infrastructure
- Remove validate subcommand import and handler
- Update help text to show all new test flags
- Update DevTestCommand usage in __init__.py
2026-01-23 13:17:37 -05:00
Vijay Janapa Reddi
12af47b635 feat(cli): add unified tito dev test command
Introduces a comprehensive testing command with explicit test type flags:
- --inline: Progressive inline tests from src/ (nbgrader tests)
- --unit: Pytest unit tests
- --cli: CLI command tests
- --integration: Cross-module tests
- --e2e: End-to-end user journey tests
- --milestone: Historical milestone tests
- --all: Run all test types (except release)
- --release: Full destructive release validation
- --module N: Test specific module

Default behavior runs unit tests only.

This consolidates validate, provides clear test hierarchy, and
matches PyTorch's explicit, predictable interface philosophy.
2026-01-23 13:17:30 -05:00
Vijay Janapa Reddi
0ce0703c67 refactor(cli): remove standalone validate command
The validate command functionality has been consolidated into
`tito dev test --release` for a unified testing interface.

This follows the PyTorch philosophy: one clear way to do things.
2026-01-23 13:17:22 -05:00
Vijay Janapa Reddi
b7fa2f8e81 feat(workflow): LLM-powered all-contributors with natural language
- Update all-contributors-add.yml to use Ollama (llama3.1:8b) for parsing
  natural language descriptions instead of requiring exact syntax
- Trim contribution types to 8 actually used: bug, code, doc, design,
  ideas, review, test, tool
- Update generate_main_readme.py and generate_readme_tables.py to match
- Remove unused tito module export subcommand (fixes #1134)
  Students should use tito module complete instead

Now you can write naturally:
  @all-contributors @user helped verify the fix worked
  @all-contributors @user found a bug in the dataloader
2026-01-23 09:01:16 -05:00
Vijay Janapa Reddi
fa04485cbc feat(workflow): LLM-powered all-contributors with natural language
- Update all-contributors-add.yml to use Ollama (llama3.1:8b) for parsing
  natural language descriptions instead of requiring exact syntax
- Trim contribution types to 8 actually used: bug, code, doc, design,
  ideas, review, test, tool
- Update generate_main_readme.py and generate_readme_tables.py to match
- Remove unused tito module export subcommand (fixes #1134)
  Students should use tito module complete instead

Now you can write naturally:
  @all-contributors @user helped verify the fix worked
  @all-contributors @user found a bug in the dataloader
2026-01-23 09:00:42 -05:00
Vijay Janapa Reddi
186615c18a fix(tinytorch): fix test ordering and non-interactive mode issues
Bug fixes:
- Move test_autograd_core.py from 05_dataloader/ to 06_autograd/ (fixes #1127)
- Fix integration test mapping: tests now only run after their dependencies
  are available (module 4 loss tests moved to module 7+)
- Remove premature test_unit_function_classes() call in 06_autograd.py
  that ran before enable_autograd() (fixes #1128)
- Handle EOFError in milestone prompts for non-interactive mode (fixes #1129)

Improvements:
- Read version from pyproject.toml as single source of truth
- Add try/except for sync prompt in milestone completion

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 12:17:32 -05:00
Vijay Janapa Reddi
7fe85bd912 refactor(tinytorch): use pyproject.toml as single source of truth for version
- Update pyproject.toml version to 0.1.4
- Set put_version_in_init = False in settings.ini to prevent nbdev overwrite
- Update tito/main.py to read version from pyproject.toml
- Update tito/__init__.py to read version from pyproject.toml
- Sync settings.ini version to 0.1.4

This ensures tito dev validate doesn't reset the version number.
2026-01-22 08:23:16 -05:00
kai
9e3bf82327 setup better auth flow and messaging 2026-01-19 20:11:52 -05:00
Vijay Janapa Reddi
871d1f473a docs: complete Perceptron 1958 standardization and add tito dev CLI docs
- Update remaining 1957→1958 references across all documentation
- Add tito dev commands (preflight, export, validate) to CLI reference
- Update CLI validation script to recognize new dev subcommands
- Fix milestone year references in tests and workflow code
- Update timeline visualization JavaScript

This completes the Perceptron year standardization to align with
the publication year and academic citation format (rosenblatt1958perceptron).

Cherry-picked from: ebf3fb17b (feature/tito-dev-validate)
2026-01-17 12:18:23 -05:00
Vijay Janapa Reddi
dbad2637e3 fix(docs): standardize Perceptron year to 1958
- Rename milestone directory from 01_1957_perceptron to 01_1958_perceptron
- Update all references to use 1958 (publication year) for consistency
  with academic citation format (rosenblatt1958perceptron)
- Changes affect: READMEs, docs, tests, milestone tracker

Rationale: Using 1958 aligns with the publication year and standard
academic citations, while 1957 was the development year.

Cherry-picked from: 28ca41582 (feature/tito-dev-validate)
2026-01-17 12:15:49 -05:00
Vijay Janapa Reddi
4b45ba326d Merge branch 'issue-1112-tito-module-05' into dev
This merge brings critical student work preservation features:

Key Changes:
- Rewrote 'tito system update' to preserve student work
  - Uses git sparse checkout for selective updates
  - Preserves: modules/, tinytorch/core/, .tito/, .venv/
  - Updates: src/, tito/, tests/, milestones/, datasets/

- Added consistent Panel warnings for destructive actions
- Removed unused TestCommand and ExportCommand (replaced by module/dev commands)
- Fixed integration tests and training module tests
- Improved optimizer and training module error handling

This addresses issue #1112 and ensures students can safely update
TinyTorch without losing their work in progress.

Commits merged:
- e7051671d chore(tito): remove unused TestCommand and ExportCommand
- abc033d8d fix(tito): rewrite update command to preserve student work
- f9fd2c8fe style(tito): use Panel warnings consistently for destructive actions
- 2ed310d6f fix(tinytorch): fix integration tests and improve update command
2026-01-17 12:14:39 -05:00
Vijay Janapa Reddi
48498d1589 feat(tito): Add 'tito dev validate' command for release validation
- Cherry-picked ValidateCommand from feature/tito-dev-validate branch
- Simulates complete student journey through curriculum
- Runs export + complete cycle for all modules (01-20)
- Executes all milestones after module validation
- Supports --ci mode for CI/CD integration
- Options: --module, --skip-milestones, --stop-on-fail
- Provides detailed pass/fail reporting with timing

This enables release validation without full branch merge conflicts.
2026-01-17 12:06:27 -05:00
Vijay Janapa Reddi
e7051671dc chore(tito): remove unused TestCommand and ExportCommand
These commands were never registered in main.py and have been replaced by:
- TestCommand → tito module test (ModuleTestCommand)
- ExportCommand → tito module export / tito dev export

Also removed unused import and variable in milestone.py.
2026-01-15 10:46:39 -05:00
Vijay Janapa Reddi
abc033d8d2 fix(tito): rewrite update command to preserve student work
The previous update command tried to re-run the install script, which
would fail on existing installations and could wipe student work.

New implementation:
- Downloads latest via git sparse checkout to temp directory
- Selectively updates: src/, tito/, tests/, milestones/, datasets/
- Preserves: modules/, tinytorch/core/*.py, .tito/, .venv/
- Reinstalls pip package to update CLI entry points

This allows students to safely run `tito system update` without
losing their work in progress.

Addresses #1112
2026-01-15 10:36:36 -05:00