Files
TinyTorch/.github/scripts/check_checkpoints.py
Vijay Janapa Reddi 9c0042f08d Add release check workflow and clean up legacy dev files
This commit implements a comprehensive quality assurance system and removes
outdated backup files from the repository.

## Release Check Workflow

Added GitHub Actions workflow for systematic release validation:
- Manual-only workflow (workflow_dispatch) - no automatic PR triggers
- 6 sequential quality gates: educational, implementation, testing, package, documentation, systems
- 13 validation scripts (4 fully implemented, 9 stubs for future work)
- Comprehensive documentation in .github/workflows/README.md
- Release process guide in .github/RELEASE_PROCESS.md

Implemented validators:
- validate_time_estimates.py - Ensures consistency between LEARNING_PATH.md and ABOUT.md files
- validate_difficulty_ratings.py - Validates star rating consistency across modules
- validate_testing_patterns.py - Checks for test_unit_* and test_module() patterns
- check_checkpoints.py - Recommends checkpoint markers for long modules (8+ hours)

## Pedagogical Improvements

Added checkpoint markers to Module 05 (Autograd):
- Checkpoint 1: After computational graph construction (~40% progress)
- Checkpoint 2: After automatic differentiation implementation (~80% progress)
- Helps students track progress through the longest foundational module (8-10 hours)

## Codebase Cleanup

Removed 20 legacy *_dev.py files across all modules:
- Confirmed via export system analysis: only *.py files (without _dev suffix) are used
- Export system explicitly reads from {name}.py (see tito/commands/export.py line 461)
- All _dev.py files were outdated backups not used by the build/export pipeline
- Verified all active .py files contain current implementations with optimizations

This cleanup:
- Eliminates confusion about which files are source of truth
- Reduces repository size
- Makes development workflow clearer (work in modules/XX_name/name.py)

## Formatting Standards Documentation

Documents formatting and style standards discovered through systematic
review of all 20 TinyTorch modules.

### Key Findings

Overall Status: 9/10 (Excellent consistency)
- All 20 modules use correct test_module() naming
- 18/20 modules have proper if __name__ guards
- All modules use proper Jupytext format (no JSON leakage)
- Strong ASCII diagram quality
- All 20 modules missing 🧪 emoji in test_module() docstrings

### Standards Documented

1. Test Function Naming: test_unit_* for units, test_module() for integration
2. if __name__ Guards: Immediate guards after every test/analysis function
3. Emoji Protocol: 🔬 for unit tests, 🧪 for module tests, 📊 for analysis
4. Markdown Formatting: Jupytext format with proper section hierarchy
5. ASCII Diagrams: Box-drawing characters, labeled dimensions, data flow arrows
6. Module Structure: Standard template with 9 sections

### Quick Fixes Identified

- Add 🧪 emoji to test_module() in all 20 modules (~5 min)
- Fix Module 16 if __name__ guards (~15 min)
- Fix Module 08 guard (~5 min)

Total quick fixes: 25 minutes to achieve 10/10 consistency
2025-11-24 14:47:04 -05:00

92 lines
2.6 KiB
Python
Executable File

#!/usr/bin/env python3
"""
Validate checkpoint markers in long modules (8+ hours).
Ensures complex modules have progress markers to help students track completion.
"""
import re
import sys
from pathlib import Path
def extract_time_estimate(about_file):
"""Extract time estimate from ABOUT.md"""
if not about_file.exists():
return 0
content = about_file.read_text()
match = re.search(r'time_estimate:\s*"(\d+)-(\d+)\s+hours"', content)
if match:
return int(match.group(2)) # Return upper bound
return 0
def count_checkpoints(about_file):
"""Count checkpoint markers in ABOUT.md"""
if not about_file.exists():
return 0
content = about_file.read_text()
# Look for checkpoint patterns
return len(re.findall(r'\*\*✓ CHECKPOINT \d+:', content))
def main():
"""Validate checkpoint markers in long modules"""
modules_dir = Path("modules")
recommendations = []
validated = []
print("🏁 Validating Checkpoint Markers")
print("=" * 60)
# Find all module directories
module_dirs = sorted([d for d in modules_dir.iterdir() if d.is_dir() and d.name[0].isdigit()])
for module_dir in module_dirs:
module_name = module_dir.name
about_file = module_dir / "ABOUT.md"
time_estimate = extract_time_estimate(about_file)
checkpoint_count = count_checkpoints(about_file)
# Modules 8+ hours should have checkpoints
if time_estimate >= 8:
if checkpoint_count == 0:
recommendations.append(
f"⚠️ {module_name} ({time_estimate}h): Consider adding checkpoint markers"
)
elif checkpoint_count >= 2:
validated.append(
f"{module_name} ({time_estimate}h): {checkpoint_count} checkpoints"
)
else:
recommendations.append(
f"⚠️ {module_name} ({time_estimate}h): Only {checkpoint_count} checkpoint (recommend 2+)"
)
else:
print(f" {module_name} ({time_estimate}h): Checkpoints not required")
print("\n" + "=" * 60)
# Print validated modules
if validated:
print("\n✅ Modules with Good Checkpoint Coverage:")
for item in validated:
print(f" {item}")
# Print recommendations
if recommendations:
print("\n💡 Recommendations:")
for rec in recommendations:
print(f" {rec}")
print("\nNote: This is informational only, not a blocker.")
print("\n✅ Checkpoint validation complete!")
sys.exit(0)
if __name__ == "__main__":
main()