OpenHands icon indicating copy to clipboard operation
OpenHands copied to clipboard

Fix pypi build

Open tofarr opened this issue 1 year ago • 1 comments

This is intended to address https://github.com/All-Hands-AI/OpenHands/issues/3527

As pointed out by a user, our build on pypi does not include agenthub. The package on pypi is pretty much broken due to missing files and dependencies.

After deploy and a new version is built to pypi, you should be able to run without errors:

  • Creating a new project using poetry poetry new test-open-hands-pypi
  • Add open hands as a dependency: poetry add openhands-ai
  • Install dependencies: poetry install
  • Run a python console: poetry run python
  • Try to import a core package: from openhands.core.main import run_controller
  • The import succeeds!

image

Before the deploy to pypi you need to build and test OpenHands locally

Then specify the location of your local version in your pyproject.toml of your test project:

e.g:

cd OpenHands
poetry build

Then : openhands = { path = "/Users/tofarr/dev/all-hands/OpenHands/dist/openhands-0.8.4.tar.gz" } image

tofarr avatar Aug 22 '24 20:08 tofarr

@tofarr When you change the version number, please also apply that to the 2 /frontend/package*.json files :)

tobitege avatar Aug 22 '24 22:08 tobitege

Hey @tofarr , we're going to have to change the name of the package to openhands-ai to match the pypi distribution. I changed that in a commit, but that's breaking other things e.g. in the runtime tests, which will have to be fixed.

neubig avatar Aug 23 '24 15:08 neubig

Just for reference, I tested this out locally and it seems to be working if I add:

openhands-ai = { git = "https://github.com/All-Hands-AI/openhands.git", rev = "fix-pypi-package" }

to pyprojects.toml. So once tests are working I think it's good to go!

neubig avatar Aug 23 '24 16:08 neubig