diff --git a/.cursor/rules/cli-patterns.mdc b/.cursor/rules/cli-patterns.mdc index efa9d5c2..eb71f71f 100644 --- a/.cursor/rules/cli-patterns.mdc +++ b/.cursor/rules/cli-patterns.mdc @@ -1,6 +1,9 @@ --- +description: CLI Development Patterns for TinyTorch +globs: alwaysApply: false --- + # CLI Development Patterns for TinyTorch ## Command Architecture @@ -165,7 +168,7 @@ in_venv = ( 6. **Handle edge cases** - Missing files, invalid arguments, etc. 7. **Provide progress feedback** - For long-running operations 8. **Use consistent styling** - Colors, borders, and formatting -description: + globs: alwaysApply: false --- diff --git a/.cursor/rules/development-workflow.mdc b/.cursor/rules/development-workflow.mdc index 429693e8..17220d09 100644 --- a/.cursor/rules/development-workflow.mdc +++ b/.cursor/rules/development-workflow.mdc @@ -1,90 +1,10 @@ +--- +description: Development workflow for TinyTorch, including CLI tool usage, development cycle, testing requirements, and Git workflow. +--- # TinyTorch Development Workflow -## CLI Tool: `tito` - -The main development tool is the `tito` CLI. Common commands: - -### Module Development -```bash -# Sync module: Python source → notebook → package export -tito sync --module {module_name} - -# Test specific module (uses pytest internally) -tito test --module {module_name} - -# Get project info and status -tito info -``` - -### Examples -```bash -# Work with setup module -tito sync --module setup -tito test --module setup - -# Work with tensor module -tito sync --module tensor -tito test --module tensor -``` - -## Development Cycle - -1. **Edit**: Modify `modules/{module}/{module}_dev.py` - - Use `#| export` to mark code for package export - - Use `#| hide` for instructor solutions - - Follow NBDev educational pattern - -2. **Sync**: `tito sync --module {module}` - - Converts Python source to Jupyter notebook - - Exports marked code to `tinytorch/` package - - Updates package structure - -3. **Test**: `tito test --module {module}` - - Runs module-specific pytest tests from `modules/{module}/tests/` - - Uses pytest framework for all test execution - - Validates exported package code - - Ensures everything works end-to-end - -4. **Commit**: Regular commits at good stages - - See [Git Workflow Guidelines](mdc:.cursor/rules/git-workflow.mdc) for commit strategies - - Commit when reaching good milestones - - Clean up experimental files before committing - -## Testing Requirements - -- **All tests must use pytest** - No manual testing or other frameworks -- Test files must be named `test_{module}.py` and located in `modules/{module}/tests/` -- Tests should use pytest classes, fixtures, and assertions -- CLI tool uses pytest internally: `subprocess.run([sys.executable, "-m", "pytest", test_file, "-v"])` - -## File Relationships - -``` -modules/{module}/{module}_dev.py → modules/{module}/{module}_dev.ipynb - ↓ - tinytorch/core/{component}.py - ↑ - modules/{module}/tests/test_{module}.py (pytest) -``` - -## Module Structure - -Each module should be self-contained with: -- `{module}_dev.py` - Main development file (Python source) -- `{module}_dev.ipynb` - Generated notebook (auto-created) -- `README.md` - Module documentation -- `tests/` - Test directory - - `test_{module}.py` - Module tests (pytest format) - -Students run and pass all pytest tests locally within the module before using nbdev to export code to the tinytorch package and build/test the overall package. - -## Git Workflow - -For commit strategies and Git best practices, see [Git Workflow Guidelines](mdc:.cursor/rules/git-workflow.mdc). - -Key principles: -- **Incremental commits** for easy reverts +## CLI Tool: ` - **Test before committing** to avoid broken commits - **Use feature branches** for larger changes - **Descriptive commit messages** that explain what changed diff --git a/.cursor/rules/git-workflow.mdc b/.cursor/rules/git-workflow.mdc index 115567f6..98e4f640 100644 --- a/.cursor/rules/git-workflow.mdc +++ b/.cursor/rules/git-workflow.mdc @@ -1,3 +1,7 @@ +--- +description: Git workflow guidelines for TinyTorch development. +--- + # Git Workflow Guidelines for TinyTorch Development ## 🎯 **Philosophy: Incremental Commits for Easy Reverts** @@ -147,3 +151,7 @@ git commit -m "Second part of changes" 5. **Commit frequently** to avoid losing work **Remember:** It's better to have many small commits than one large commit that's hard to revert or understand. + +5. **Commit frequently** to avoid losing work + +**Remember:** It's better to have many small commits than one large commit that's hard to revert or understand. diff --git a/.cursor/rules/module-development-best-practices.mdc b/.cursor/rules/module-development-best-practices.mdc index 3d110bac..6b944f5c 100644 --- a/.cursor/rules/module-development-best-practices.mdc +++ b/.cursor/rules/module-development-best-practices.mdc @@ -1,3 +1,4 @@ + # TinyTorch Module Development Best Practices ## Core Principles @@ -266,3 +267,7 @@ description: globs: alwaysApply: false --- + +globs: +alwaysApply: false +--- diff --git a/.cursor/rules/nbdev-educational-pattern.mdc b/.cursor/rules/nbdev-educational-pattern.mdc index a0ce1faf..2e737cdc 100644 --- a/.cursor/rules/nbdev-educational-pattern.mdc +++ b/.cursor/rules/nbdev-educational-pattern.mdc @@ -1,4 +1,5 @@ + # NBDev Educational Pattern for TinyTorch Modules When working with module development files (`*_dev.py`), follow this educational structure: @@ -255,3 +256,7 @@ All modules must: ## Naming Convention Module files should be named `{module_name}_dev.py` to indicate development notebooks, following the established pattern from [modules/setup/setup_dev.py](mdc:modules/setup/setup_dev.py) and [modules/tensor/tensor_dev.py](mdc:modules/tensor/tensor_dev.py). + +## Naming Convention + +Module files should be named `{module_name}_dev.py` to indicate development notebooks, following the established pattern from [modules/setup/setup_dev.py](mdc:modules/setup/setup_dev.py) and [modules/tensor/tensor_dev.py](mdc:modules/tensor/tensor_dev.py). diff --git a/.cursor/rules/testing-patterns.mdc b/.cursor/rules/testing-patterns.mdc index f4eae24a..348451d9 100644 --- a/.cursor/rules/testing-patterns.mdc +++ b/.cursor/rules/testing-patterns.mdc @@ -1,3 +1,6 @@ +--- +description: "Testing patterns for TinyTorch, including framework requirements, core principles, file structure, naming convention, and test patterns." +--- # Testing Patterns for TinyTorch @@ -291,4 +294,8 @@ result = subprocess.run([sys.executable, "-m", "pytest", test_file, "-v"]) ``` This ensures all tests run through pytest with consistent output and reporting, using real data throughout the testing process. + +``` + +This ensures all tests run through pytest with consistent output and reporting, using real data throughout the testing process. \ No newline at end of file diff --git a/.cursor/rules/tinytorch-project-structure.mdc b/.cursor/rules/tinytorch-project-structure.mdc index 226f960a..e8dd7ded 100644 --- a/.cursor/rules/tinytorch-project-structure.mdc +++ b/.cursor/rules/tinytorch-project-structure.mdc @@ -1,3 +1,6 @@ +--- +description: A guide to the project structure of the TinyTorch ML framework. +--- # TinyTorch Project Structure Guide @@ -52,5 +55,9 @@ The `#| default_exp` directive controls where code exports to in the package. +The `#| default_exp` directive controls where code exports to in the package. + + + The `#| default_exp` directive controls where code exports to in the package. \ No newline at end of file diff --git a/.cursor/rules/user-preferences.mdc b/.cursor/rules/user-preferences.mdc index e6762242..6c511fb4 100644 --- a/.cursor/rules/user-preferences.mdc +++ b/.cursor/rules/user-preferences.mdc @@ -1,3 +1,8 @@ +--- +description: User preferences and development conventions for TinyTorch, including module naming patterns, commit frequency, testing standards, and NBDev integration workflow. +alwaysApply: false +--- + # User Preferences and Conventions