fix(tinytorch): tito package nbdev --test/--clean/--build-docs crash, wrong command names - #1975
Open
Shashank-Tripathi-07 wants to merge 1 commit into
Conversation
… wrong command names All three call subprocess.run(["nbdev_docs"]) / ["nbdev_test"] / ["nbdev_clean"] (underscores). nbdev 3.x registers these console scripts with hyphens instead (nbdev-docs, nbdev-test, nbdev-clean -- confirmed against what's actually installed in a venv's Scripts/bin directory); the underscore names have never existed, so every one of these crashed with an unhandled FileNotFoundError and a raw traceback. Renamed to the correct hyphenated commands and consolidated the three near-identical subprocess.run/result-handling blocks into one _run_nbdev_tool() helper, which also now catches FileNotFoundError with a message pointing at what's actually missing (matching the same pattern already used for the other subprocess calls fixed this session), and applies the encoding="utf-8", errors="replace" fix from the sibling subprocess-encoding PR so this doesn't regress if that merges in a different order. Verified: `tito package nbdev --clean` now runs successfully instead of crashing.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug
`tito package nbdev --clean` (and `--test`, `--build-docs`) crash outright:
```
FileNotFoundError: [WinError 2] The system cannot find the file specified
❌ Unexpected error: [WinError 2] The system cannot find the file specified
```
Root cause
All three call `subprocess.run(["nbdev_docs"])` / `["nbdev_test"]` / `["nbdev_clean"]` (underscores). nbdev 3.x actually registers these console scripts with hyphens -- confirmed by listing what's really installed in a venv's `Scripts/` directory: `nbdev-docs.exe`, `nbdev-test.exe`, `nbdev-clean.exe`, not the underscore forms. The underscore names have never existed, so these three code paths always crash.
Fix
Testing
`tito package nbdev --clean` now runs successfully instead of crashing. Found while running every `tito` command group end to end looking for exactly this class of bug.