fix: add __main__.py to support python -m notebooklm#164
fix: add __main__.py to support python -m notebooklm#164teng-lin merged 2 commits intoteng-lin:mainfrom
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request resolves a critical usability issue where the Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request adds a __main__.py file to enable running the package as a module with python -m notebooklm. The change is correct and achieves its goal. I've provided one suggestion to improve the robustness of the new entry point by following standard Python practices for executable scripts.
src/notebooklm/__main__.py
Outdated
| from notebooklm.notebooklm_cli import main | ||
|
|
||
| main() |
There was a problem hiding this comment.
It's a good practice to wrap executable code within an if __name__ == "__main__": block. This prevents the code from running if this module is ever imported by another script, which could cause unexpected side effects. This also makes it clear that this file is intended to be an executable entry point. Moving the import inside the block also has the minor benefit of avoiding the import if the module is not being executed.
| from notebooklm.notebooklm_cli import main | |
| main() | |
| if __name__ == "__main__": | |
| from notebooklm.notebooklm_cli import main | |
| main() |
Prevents main() from running on import.
|
Thanks @Bortlesboat — great catch and clean fix! |
Summary
python -m notebooklmfails withNo module named notebooklm.__main__. The CLI works fine via the installed entry point, but the module invocation path is missing.Adds
src/notebooklm/__main__.pythat imports and calls the existing CLImain().Fixes #159