Summary
- When
nbdev_export fails, it’s hard to pinpoint which .ipynb and line caused the error.
- 当
nbdev_export 报错时,往往难以快速定位到底是哪个 .ipynb、哪一行出错。
What Is It
nbscholar_check performs strict Python AST checks per notebook and prints VSCode-clickable errors (/abs/path.ipynb:line:column: SyntaxError: ...).
nbscholar_export acts as a drop-in companion to nbdev_export: on failure, it guides you to run nbscholar_check for fast pinpointing.
nbscholar_check 对每个笔记本进行严格的 Python AST 校验,并以 VSCode 可点击格式输出错误(/abs/path.ipynb:line:column: SyntaxError: ...)。
nbscholar_export 是 nbdev_export 的伴侣:失败时提示使用 nbscholar_check 快速定位问题。
Why It Helps
- Export cells are enforced with strict AST (cells starting with
#| export / #| exporti); non-export cells tolerate common IPython syntax (%%, %, ?/??) to avoid false positives.
- Errors show as clickable links in VSCode’s terminal, taking you directly to the file, line, and column.
- 对导出单元(以
#| export / #| exporti 开头)严格 AST;普通单元兼容 IPython 常见语法,减少误报。
- VSCode 终端中以可点击链接展示错误,直达文件、行列位置,定位更高效。
Quick Start
pip install git+https://github.com/THU-CVML/ScholarlyInfrastructure.git
- Check a file or directory
- Export companion (same usage as nbdev_export)
pip install git+https://github.com/THU-CVML/ScholarlyInfrastructure.git
- 作为导出伴侣(与 nbdev_export 用法一致)
Example Output
/absolute/path/to/notebooks/03_nbscholar (nbdev extensions).ipynb:123:7: SyntaxError: invalid syntax (cell 5)
- 点击该链接即可在 VSCode 中打开对应
.ipynb 并跳到相应行列。
- 在 VSCode 终端中点击即可直达错误位置与上下文。
Call To Action
- Try
nbscholar_check / nbscholar_export and share feedback: https://github.com/THU-CVML/ScholarlyInfrastructure.git
- If this improves your export and debugging workflow, please give us a Star!
- 欢迎试用并反馈:
https://github.com/THU-CVML/ScholarlyInfrastructure.git
- 如果觉得好用,欢迎点 Star 支持我们!
Summary
nbdev_exportfails, it’s hard to pinpoint which.ipynband line caused the error.nbdev_export报错时,往往难以快速定位到底是哪个.ipynb、哪一行出错。What Is It
nbscholar_checkperforms strict Python AST checks per notebook and prints VSCode-clickable errors (/abs/path.ipynb:line:column: SyntaxError: ...).nbscholar_exportacts as a drop-in companion tonbdev_export: on failure, it guides you to runnbscholar_checkfor fast pinpointing.nbscholar_check对每个笔记本进行严格的 Python AST 校验,并以 VSCode 可点击格式输出错误(/abs/path.ipynb:line:column: SyntaxError: ...)。nbscholar_export是nbdev_export的伴侣:失败时提示使用nbscholar_check快速定位问题。Why It Helps
#| export/#| exporti); non-export cells tolerate common IPython syntax (%%,%,?/??) to avoid false positives.#| export/#| exporti开头)严格 AST;普通单元兼容 IPython 常见语法,减少误报。Quick Start
nbscholar_check .nbscholar_check .Example Output
/absolute/path/to/notebooks/03_nbscholar (nbdev extensions).ipynb:123:7: SyntaxError: invalid syntax (cell 5).ipynb并跳到相应行列。Call To Action
nbscholar_check/nbscholar_exportand share feedback:https://github.com/THU-CVML/ScholarlyInfrastructure.githttps://github.com/THU-CVML/ScholarlyInfrastructure.git