Skip to content

fix: add __main__.py to support python -m notebooklm#164

Merged
teng-lin merged 2 commits intoteng-lin:mainfrom
Bortlesboat:fix/module-entry-point
Mar 10, 2026
Merged

fix: add __main__.py to support python -m notebooklm#164
teng-lin merged 2 commits intoteng-lin:mainfrom
Bortlesboat:fix/module-entry-point

Conversation

@Bortlesboat
Copy link
Contributor

Summary

python -m notebooklm fails with No module named notebooklm.__main__. The CLI works fine via the installed entry point, but the module invocation path is missing.

Adds src/notebooklm/__main__.py that imports and calls the existing CLI main().

Fixes #159

@gemini-code-assist
Copy link

Summary of Changes

Hello, 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 notebooklm package could not be executed directly as a module using the python -m command. By introducing a __main__.py file, the package now correctly invokes its command-line interface, aligning with standard Python module execution practices and improving developer experience.

Highlights

  • Bug Fix: Resolved an issue where running python -m notebooklm failed with a 'No module named notebooklm.main' error.
  • Module Invocation: Enabled direct module execution for the notebooklm package by adding a __main__.py file.
  • CLI Integration: The new __main__.py file imports and calls the existing notebooklm_cli.main() function, ensuring consistent CLI behavior.
Changelog
  • src/notebooklm/main.py
    • Added a new file to allow the notebooklm package to be run directly as a module using python -m.
Activity
  • No human activity has been recorded on this pull request yet.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +3 to +5
from notebooklm.notebooklm_cli import main

main()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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.

Suggested change
from notebooklm.notebooklm_cli import main
main()
if __name__ == "__main__":
from notebooklm.notebooklm_cli import main
main()

Prevents main() from running on import.
@teng-lin
Copy link
Owner

Thanks @Bortlesboat — great catch and clean fix!

@teng-lin teng-lin merged commit fd06d91 into teng-lin:main Mar 10, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TypeError: NotebookLMClient.__init__() missing 1 required positional argument: 'auth' in v0.3.3

2 participants