-
Notifications
You must be signed in to change notification settings - Fork 0
Fix Windows CLI entry point import error (ModuleNotFoundError: No module named 'cli') #51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
JPrier
merged 3 commits into
main
from
copilot/fix-44e57dd4-1c9d-4ad7-9ce6-bc485a3d8641
Sep 27, 2025
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| """CLI entry point compatibility module. | ||
|
|
||
| This module provides compatibility for Windows installations where | ||
| entry points might resolve differently. It imports and re-exports | ||
| the main function from the actual CLI module. | ||
|
|
||
| This addresses the issue where Windows pip installations generate entry scripts | ||
| that import 'cli' instead of 'src.cli', causing ModuleNotFoundError. | ||
| """ | ||
|
|
||
| try: | ||
| # Try to import from the src package structure (development/editable install) | ||
| from src.cli import main | ||
| except ImportError: | ||
| # Fallback for potential different package structures | ||
| try: | ||
| from .cli import main | ||
| except ImportError: | ||
| raise ImportError("Could not import CLI main function from either src.cli or .cli") | ||
|
|
||
| __all__ = ['main'] | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| #!/usr/bin/env python3 | ||
| """Main entry point for TreeAgent CLI when run as module (python -m treeagent).""" | ||
|
|
||
| from src.cli import main | ||
|
|
||
| if __name__ == "__main__": | ||
| main() |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[P1] Ensure compatibility shim is packaged
The new
cli.pymakes the Windows entry-point import succeed only when the file is present in the installation, but the build configuration (pyproject.tomlpackages only thesrcdirectory) does not include top-level modules. A wheel built from this repo will still omitcli.py, sotreeagent.exeon Windows continues to raiseModuleNotFoundError: No module named 'cli'. Consider moving this shim into thesrcpackage or updating the packaging configuration so the module is shipped.Useful? React with 👍 / 👎.