mirror of
https://github.com/harvard-edge/cs249r_book.git
synced 2026-05-21 05:28:28 -05:00
[PR #1686] fix(tinytorch): strip solution blocks when generating student notebook via tito module start #12958
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/harvard-edge/cs249r_book/pull/1686
Author: @Shashank-Tripathi-07
Created: 5/6/2026
Status: 🔄 Open
Base:
dev← Head:fix/tinytorch-module-start-strips-solutions📝 Commits (1)
bf9ce85fix(tinytorch): strip solution blocks when generating student notebook via tito module start📊 Changes
1 file changed (+38 additions, -8 deletions)
View changed files
📝
tinytorch/tito/commands/module/workflow.py(+38 -8)📄 Description
Bug
Closes #1684
tito module start 01was passing the fullsrc/01_tensor/01_tensor.py-- including all### BEGIN SOLUTION/### END SOLUTIONblocks -- directly to jupytext. Students received notebooks with every answer already implemented, defeating the purpose of the exercises.The docstring in
_create_module_from_srceven acknowledged this explicitly:Root cause
_create_module_from_srcinworkflow.pycalledconvert_py_to_notebookon the raw source path with no stripping step. Solution stripping was not implemented anywhere in thetito modulepath.Fix
Before passing to jupytext, strip solution blocks in memory and write to a temp directory:
The stripped source is written to a
tempfile.TemporaryDirectory, jupytext converts it, and the temp dir is cleaned up automatically. The originalsrc/files are never modified.Verification
After the fix,
tito module start 01generatesmodules/01_tensor/tensor.ipynbwith emptypassstubs and TODO comments -- no implemented solutions.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.