Skip to content

Conversation

Copy link

Copilot AI commented Oct 7, 2025

Problem

The setup.py file defined a console script entry point openmanus=main:main, but the main.py file only contained an async function async def main(). This caused the entry point to fail because setuptools console scripts require a synchronous callable function.

Users who installed the package via pip could not use the openmanus command as intended. The only way to run OpenManus was through python main.py, which required users to navigate to the repository directory.

Solution

This PR refactors main.py to properly support the console script entry point while maintaining full backward compatibility:

  1. Renamed the async function: The existing async def main() is now async def async_main() to contain all the async logic
  2. Created a synchronous entry point: Added a new def main() function that calls asyncio.run(async_main())
  3. Updated the main block: Changed if __name__ == "__main__" to call the new main() function

This allows the package to work both ways:

  • After installation: Users can run openmanus from anywhere on their system
  • From source: Users can still run python main.py as before

Changes

main.py (9 lines):

# Before
async def main():
    # ... async implementation ...

if __name__ == "__main__":
    asyncio.run(main())

# After  
async def async_main():
    # ... async implementation ...

def main():
    """Entry point for the openmanus console script."""
    asyncio.run(async_main())

if __name__ == "__main__":
    main()

README.md (6 lines):

  • Added documentation for the openmanus command usage after installation
  • Preserved existing python main.py documentation for source users

Testing

  • ✅ Python syntax validation passed
  • ✅ Function structure verified for setuptools compatibility
  • ✅ No breaking changes to existing code
  • ✅ Backward compatibility maintained with direct script execution

Fixes the console script entry point to enable the openmanus command as originally intended in setup.py.

Original prompt

run

Created from VS Code via the [GitHub Pull Request](https://marketplace.visualstudio.com/items?itemName=GitHub.vscode-pull-request-github) extension.

💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Copilot AI and others added 2 commits October 7, 2025 15:51
Co-authored-by: Copyxyzai <168319629+Copyxyzai@users.noreply.github.com>
Co-authored-by: Copyxyzai <168319629+Copyxyzai@users.noreply.github.com>
Copilot AI changed the title [WIP] Add run functionality to main application Add proper console script entry point for openmanus command Oct 7, 2025
Copilot AI requested a review from Copyxyzai October 7, 2025 15:55
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.

2 participants