diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml index 09d411463d3..d1727a64082 100644 --- a/.github/workflows/examples.yml +++ b/.github/workflows/examples.yml @@ -17,6 +17,22 @@ jobs: matrix: os: [ubuntu-latest] python-version: ["3.10"] + package: + [ + autogen, + camel, + claude, + crew_ai, + griptape, + julep, + langchain, + llamaindex, + lyzr, + openai, + praisonai, + langgraph, + phidata, + ] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@master @@ -36,10 +52,9 @@ jobs: sudo apt-get autoclean python -m pip install --upgrade pip pipenv pytest - ls -1 plugins | awk '$0="plugins/"$0"/"' | xargs -L1 pipenv run pip3 install - pipenv install - pipenv run pip3 install '.[all]' - pipenv run pip install 'numpy<2' - pipenv run composio apps update - - CI=false COMPOSIO_BASE_URL=https://backend.composio.dev/api pipenv run pytest -vv tests/test_example.py \ No newline at end of file + python -m pip pip3 install plugins/${{matrix.package}} + python -m pip pip3 install '.[all]' + python -m pip pip install 'numpy<2' python-dotenv + python -m pip composio apps update + + CI=false COMPOSIO_BASE_URL=https://backend.composio.dev/api PLUGIN_TO_TEST=${{matrix.package}} python -m pytest -vv tests/test_example.py diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 8ed20774e1a..1f58bf8c3cf 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -11,262 +11,262 @@ on: default: false jobs: - # test-examples: - # if: ${{ !inputs.skip_tests }} - # uses: ./.github/workflows/examples.yml - # with: - # working-directory: ./python - # secrets: inherit + test-examples: + if: ${{ !inputs.skip_tests }} + uses: ./.github/workflows/examples.yml + with: + working-directory: ./python + secrets: inherit - publish-core: - name: Create Framework & Plugin Releases - # needs: test-examples - defaults: - run: - working-directory: ./python - strategy: - matrix: - os: [ubuntu-latest] - python-version: ["3.10"] - runs-on: ${{ matrix.os }} - steps: - - uses: actions/checkout@master - - uses: actions/setup-python@v3 - with: - python-version: ${{ matrix.python-version }} - - name: Build - run: | - sudo apt-get update --fix-missing - sudo apt-get autoremove - sudo apt-get autoclean - python -m pip install --upgrade pip - pip install twine build + # publish-core: + # name: Create Framework & Plugin Releases + # # needs: test-examples + # defaults: + # run: + # working-directory: ./python + # strategy: + # matrix: + # os: [ubuntu-latest] + # python-version: ["3.10"] + # runs-on: ${{ matrix.os }} + # steps: + # - uses: actions/checkout@master + # - uses: actions/setup-python@v3 + # with: + # python-version: ${{ matrix.python-version }} + # - name: Build + # run: | + # sudo apt-get update --fix-missing + # sudo apt-get autoremove + # sudo apt-get autoclean + # python -m pip install --upgrade pip + # pip install twine build - # Build dist - python -m build - - name: Publish Core to PyPI - uses: pypa/gh-action-pypi-publish@release/v1 - with: - user: ${{ secrets.PYPI_USERNAME }} - password: ${{ secrets.PYPI_PASSWORD }} - skip-existing: true - packages-dir: python/dist/ + # # Build dist + # python -m build + # - name: Publish Core to PyPI + # uses: pypa/gh-action-pypi-publish@release/v1 + # with: + # user: ${{ secrets.PYPI_USERNAME }} + # password: ${{ secrets.PYPI_PASSWORD }} + # skip-existing: true + # packages-dir: python/dist/ - publish-plugins: - needs: publish-core - name: Create Plugin Releases - defaults: - run: - working-directory: ./python - strategy: - max-parallel: 1 - matrix: - os: [ubuntu-latest] - python-version: ["3.10"] - package: - [ - autogen, - camel, - claude, - crew_ai, - griptape, - julep, - langchain, - llamaindex, - lyzr, - openai, - praisonai, - langgraph, - phidata, - ] - runs-on: ${{ matrix.os }} - steps: - - uses: actions/checkout@v2 - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - - name: Build ${{ matrix.package }} - run: | - sudo apt-get update --fix-missing - sudo apt-get autoremove - sudo apt-get autoclean - python -m pip install --upgrade pip - pip install twine build + # publish-plugins: + # needs: publish-core + # name: Create Plugin Releases + # defaults: + # run: + # working-directory: ./python + # strategy: + # max-parallel: 1 + # matrix: + # os: [ubuntu-latest] + # python-version: ["3.10"] + # package: + # [ + # autogen, + # camel, + # claude, + # crew_ai, + # griptape, + # julep, + # langchain, + # llamaindex, + # lyzr, + # openai, + # praisonai, + # langgraph, + # phidata, + # ] + # runs-on: ${{ matrix.os }} + # steps: + # - uses: actions/checkout@v2 + # - name: Set up Python + # uses: actions/setup-python@v2 + # with: + # python-version: ${{ matrix.python-version }} + # - name: Build ${{ matrix.package }} + # run: | + # sudo apt-get update --fix-missing + # sudo apt-get autoremove + # sudo apt-get autoclean + # python -m pip install --upgrade pip + # pip install twine build - # Build dist - cd plugins/${{ matrix.package }} - python -m build - - name: Publish ${{ matrix.package }} to PyPI - uses: pypa/gh-action-pypi-publish@release/v1 - with: - user: ${{ secrets.PYPI_USERNAME }} - password: ${{ secrets.PYPI_PASSWORD }} - skip-existing: true - packages-dir: python/plugins/${{ matrix.package }}/dist/ + # # Build dist + # cd plugins/${{ matrix.package }} + # python -m build + # - name: Publish ${{ matrix.package }} to PyPI + # uses: pypa/gh-action-pypi-publish@release/v1 + # with: + # user: ${{ secrets.PYPI_USERNAME }} + # password: ${{ secrets.PYPI_PASSWORD }} + # skip-existing: true + # packages-dir: python/plugins/${{ matrix.package }}/dist/ - publish-swe: - needs: publish-core - name: Create SWE Toolkit Release - defaults: - run: - working-directory: ./python/swe - strategy: - max-parallel: 1 - matrix: - os: [ubuntu-latest] - python-version: ["3.10"] - runs-on: ${{ matrix.os }} - steps: - - uses: actions/checkout@v2 - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - - name: Build - run: | - sudo apt-get update --fix-missing - sudo apt-get autoremove - sudo apt-get autoclean - python -m pip install --upgrade pip - pip install twine build + # publish-swe: + # needs: publish-core + # name: Create SWE Toolkit Release + # defaults: + # run: + # working-directory: ./python/swe + # strategy: + # max-parallel: 1 + # matrix: + # os: [ubuntu-latest] + # python-version: ["3.10"] + # runs-on: ${{ matrix.os }} + # steps: + # - uses: actions/checkout@v2 + # - name: Set up Python + # uses: actions/setup-python@v2 + # with: + # python-version: ${{ matrix.python-version }} + # - name: Build + # run: | + # sudo apt-get update --fix-missing + # sudo apt-get autoremove + # sudo apt-get autoclean + # python -m pip install --upgrade pip + # pip install twine build - # Build dist - python -m build - - name: Publish SWE Kit to PyPI - uses: pypa/gh-action-pypi-publish@release/v1 - with: - user: ${{ secrets.PYPI_USERNAME }} - password: ${{ secrets.PYPI_PASSWORD }} - skip-existing: true - packages-dir: python/swe/dist/ + # # Build dist + # python -m build + # - name: Publish SWE Kit to PyPI + # uses: pypa/gh-action-pypi-publish@release/v1 + # with: + # user: ${{ secrets.PYPI_USERNAME }} + # password: ${{ secrets.PYPI_PASSWORD }} + # skip-existing: true + # packages-dir: python/swe/dist/ - publish-cli: - name: Build and upload CLI - needs: publish-core - permissions: write-all - strategy: - matrix: - os: [ubuntu-latest, macos-12, macos-14, windows-latest] - runs-on: ${{ matrix.os }} - steps: - - name: Checkout code - uses: actions/checkout@v2 - - uses: actions/setup-python@v3 - with: - python-version: "3.10" - - name: Build for ${{ matrix.os }} - run: | - python -m pip install --upgrade pip - pip install pyinstaller + # publish-cli: + # name: Build and upload CLI + # needs: publish-core + # permissions: write-all + # strategy: + # matrix: + # os: [ubuntu-latest, macos-12, macos-14, windows-latest] + # runs-on: ${{ matrix.os }} + # steps: + # - name: Checkout code + # uses: actions/checkout@v2 + # - uses: actions/setup-python@v3 + # with: + # python-version: "3.10" + # - name: Build for ${{ matrix.os }} + # run: | + # python -m pip install --upgrade pip + # pip install pyinstaller - cd python/ - pip3 install . + # cd python/ + # pip3 install . - # Build CLI - pyinstaller composio/cli/__main__.py + # # Build CLI + # pyinstaller composio/cli/__main__.py - # Ubuntu Release - - if: matrix.os == 'ubuntu-latest' - run: | - cd python/ - mv dist/__main__ dist/bin - mv dist/bin/__main__ dist/bin/composio + # # Ubuntu Release + # - if: matrix.os == 'ubuntu-latest' + # run: | + # cd python/ + # mv dist/__main__ dist/bin + # mv dist/bin/__main__ dist/bin/composio - cd dist/ - zip -r composio-linux-amd64.zip bin/* - rm -rf bin/ - - if: matrix.os == 'ubuntu-latest' - name: Upload artifact - uses: softprops/action-gh-release@v2 - with: - files: python/dist/composio-linux-amd64.zip + # cd dist/ + # zip -r composio-linux-amd64.zip bin/* + # rm -rf bin/ + # - if: matrix.os == 'ubuntu-latest' + # name: Upload artifact + # uses: softprops/action-gh-release@v2 + # with: + # files: python/dist/composio-linux-amd64.zip - # Mac Intel Release - - if: matrix.os == 'macos-12' - run: | - cd python/ - mv dist/__main__ dist/bin - mv dist/bin/__main__ dist/bin/composio + # # Mac Intel Release + # - if: matrix.os == 'macos-12' + # run: | + # cd python/ + # mv dist/__main__ dist/bin + # mv dist/bin/__main__ dist/bin/composio - cd dist/ - zip -r composio-darwin-amd64.zip bin/* - rm -rf bin/ - - if: matrix.os == 'macos-12' - name: Upload artifact - uses: softprops/action-gh-release@v2 - with: - files: python/dist/composio-darwin-amd64.zip + # cd dist/ + # zip -r composio-darwin-amd64.zip bin/* + # rm -rf bin/ + # - if: matrix.os == 'macos-12' + # name: Upload artifact + # uses: softprops/action-gh-release@v2 + # with: + # files: python/dist/composio-darwin-amd64.zip - # Mac ARM Release - - if: matrix.os == 'macos-14' - run: | - cd python/ - mv dist/__main__ dist/bin - mv dist/bin/__main__ dist/bin/composio + # # Mac ARM Release + # - if: matrix.os == 'macos-14' + # run: | + # cd python/ + # mv dist/__main__ dist/bin + # mv dist/bin/__main__ dist/bin/composio - cd dist/ - zip -r composio-darwin-arm64.zip bin/* - rm -rf bin/ - - if: matrix.os == 'macos-14' - name: Upload artifact - uses: softprops/action-gh-release@v2 - with: - files: python/dist/composio-darwin-arm64.zip + # cd dist/ + # zip -r composio-darwin-arm64.zip bin/* + # rm -rf bin/ + # - if: matrix.os == 'macos-14' + # name: Upload artifact + # uses: softprops/action-gh-release@v2 + # with: + # files: python/dist/composio-darwin-arm64.zip - # # Windows release - # - if: matrix.os == 'windows-latest' - # run: | - # cd python/ - # mv dist/__main__ dist/bin - # mv dist/bin/__main__.exe dist/bin/composio.exe + # # # Windows release + # # - if: matrix.os == 'windows-latest' + # # run: | + # # cd python/ + # # mv dist/__main__ dist/bin + # # mv dist/bin/__main__.exe dist/bin/composio.exe - # cd dist/ - # zip -r composio-win.zip bin/* - # rm -rf bin/ - # - if: matrix.os == 'windows-latest' - # name: Upload artifact - # uses: softprops/action-gh-release@v2 - # with: - # files: python/dist/composio-win.zip + # # cd dist/ + # # zip -r composio-win.zip bin/* + # # rm -rf bin/ + # # - if: matrix.os == 'windows-latest' + # # name: Upload artifact + # # uses: softprops/action-gh-release@v2 + # # with: + # # files: python/dist/composio-win.zip - publish-images: - name: Build and publish docker images - needs: publish-core - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v2 - - name: Docker login - env: - DOCKER_USER: ${{secrets.DOCKER_USER}} - DOCKER_PASSWORD: ${{secrets.DOCKER_PASSWORD}} - run: | - echo $DOCKER_PASSWORD | docker login --username $DOCKER_USER --password-stdin - - name: Set up support for multi platform build - run: | - docker run --privileged --rm tonistiigi/binfmt --install all - docker buildx create --use --name multibuild - docker buildx inspect --bootstrap - - name: Publishing tool server images - run: | - cd python/dockerfiles/ - VERSION=$(cat ../composio/__init__.py | grep version | cut -b 16- | rev | cut -b 2- | rev) make publish + # publish-images: + # name: Build and publish docker images + # needs: publish-core + # runs-on: ubuntu-latest + # steps: + # - name: Checkout code + # uses: actions/checkout@v2 + # - name: Docker login + # env: + # DOCKER_USER: ${{secrets.DOCKER_USER}} + # DOCKER_PASSWORD: ${{secrets.DOCKER_PASSWORD}} + # run: | + # echo $DOCKER_PASSWORD | docker login --username $DOCKER_USER --password-stdin + # - name: Set up support for multi platform build + # run: | + # docker run --privileged --rm tonistiigi/binfmt --install all + # docker buildx create --use --name multibuild + # docker buildx inspect --bootstrap + # - name: Publishing tool server images + # run: | + # cd python/dockerfiles/ + # VERSION=$(cat ../composio/__init__.py | grep version | cut -b 16- | rev | cut -b 2- | rev) make publish - publish-e2b: - name: Publish E2B template - needs: publish-core - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v2 - - uses: actions/setup-node@v4 - - name: Install E2B - run: | - npm install -g @e2b/cli@latest - - name: Publishing Template - env: - E2B_ACCESS_TOKEN: ${{secrets.E2B_ACCESS_TOKEN}} - run: | - cd python/dockerfiles/ - make e2b \ No newline at end of file + # publish-e2b: + # name: Publish E2B template + # needs: publish-core + # runs-on: ubuntu-latest + # steps: + # - name: Checkout code + # uses: actions/checkout@v2 + # - uses: actions/setup-node@v4 + # - name: Install E2B + # run: | + # npm install -g @e2b/cli@latest + # - name: Publishing Template + # env: + # E2B_ACCESS_TOKEN: ${{secrets.E2B_ACCESS_TOKEN}} + # run: | + # cd python/dockerfiles/ + # make e2b \ No newline at end of file diff --git a/python/tests/test_example.py b/python/tests/test_example.py index 789fc24e41c..7b8d7484b76 100644 --- a/python/tests/test_example.py +++ b/python/tests/test_example.py @@ -23,6 +23,7 @@ # Plugin test definitions EXAMPLES = { "autogen": { + "plugin": "autogen", "file": PLUGINS / "autogen" / "autogen_demo.py", "match": { "type": "stdout", @@ -36,6 +37,7 @@ }, }, "llamaindex": { + "plugin": "llamaindex", "file": PLUGINS / "llamaindex" / "llamaindex_demo.py", "match": { "type": "stdout", @@ -49,6 +51,7 @@ }, }, "local_tools": { + "plugin": "autogen", "file": EXAMPLES_PATH / "local_tools" / "autogen_math.py", "match": { "type": "stdout", @@ -59,6 +62,7 @@ "env": {"OPENAI_API_KEY": OPENAI_API_KEY}, }, "runtime_tools": { + "plugin": "langchain", "file": EXAMPLES_PATH / "runtime_tools" / "langchain_math.py", "match": { "type": "stdout", @@ -67,6 +71,7 @@ "env": {"OPENAI_API_KEY": OPENAI_API_KEY}, }, "crewai": { + "plugin": "crewai", "file": PLUGINS / "crew_ai" / "crewai_demo.py", "match": { "type": "stdout", @@ -80,20 +85,22 @@ }, }, # TOFIX(@kaave): httpcore.UnsupportedProtocol: Request URL is missing an 'http://' or 'https://' protocol. - # "julep": { - # "file": PLUGINS / "julep" / "julep_demo.py", - # "match": { - # "type": "stdout", - # "values": ["finish_reason="], - # }, - # "env": { - # "OPENAI_API_KEY": OPENAI_API_KEY, - # "COMPOSIO_API_KEY": COMPOSIO_API_KEY, - # "JULEP_API_KEY": JULEP_API_KEY, - # "JULEP_API_URL": JULEP_API_URL, - # }, - # }, + "julep": { + "plugin": "julep", + "file": PLUGINS / "julep" / "julep_demo.py", + "match": { + "type": "stdout", + "values": ["finish_reason="], + }, + "env": { + "OPENAI_API_KEY": OPENAI_API_KEY, + "COMPOSIO_API_KEY": COMPOSIO_API_KEY, + "JULEP_API_KEY": JULEP_API_KEY, + "JULEP_API_URL": JULEP_API_URL, + }, + }, "langchain": { + "plugin": "langchain", "file": PLUGINS / "langchain" / "langchain_demo.py", "match": { "type": "stdout", @@ -103,17 +110,19 @@ }, "env": {"OPENAI_API_KEY": OPENAI_API_KEY, "COMPOSIO_API_KEY": COMPOSIO_API_KEY}, }, - # "langgraph": { - # "file": PLUGINS / "langgraph" / "langgraph_demo.py", - # "match": { - # "type": "stdout", - # "values": [ - # "{'execution_details': {'executed': True}, 'response_data': ''}" - # ], - # }, - # "env": {"OPENAI_API_KEY": OPENAI_API_KEY, "COMPOSIO_API_KEY": COMPOSIO_API_KEY}, - # }, + "langgraph": { + "plugin": "langgraph", + "file": PLUGINS / "langgraph" / "langgraph_demo.py", + "match": { + "type": "stdout", + "values": [ + "{'execution_details': {'executed': True}, 'response_data': ''}" + ], + }, + "env": {"OPENAI_API_KEY": OPENAI_API_KEY, "COMPOSIO_API_KEY": COMPOSIO_API_KEY}, + }, "openai": { + "plugin": "openai", "file": PLUGINS / "openai" / "openai_demo.py", "match": { "type": "stdout", @@ -124,6 +133,7 @@ "env": {"OPENAI_API_KEY": OPENAI_API_KEY, "COMPOSIO_API_KEY": COMPOSIO_API_KEY}, }, "lyzr": { + "plugin": "lyzr", "file": PLUGINS / "lyzr" / "lyzr_demo.py", "match": { "type": "stdout", @@ -133,16 +143,17 @@ }, "env": {"OPENAI_API_KEY": OPENAI_API_KEY, "COMPOSIO_API_KEY": COMPOSIO_API_KEY}, }, - # "praisonai": { - # "file": PLUGINS / "praisonai" / "praisonai_demo.py", - # "match": { - # "type": "stdout", - # "values": [ - # "{'execution_details': {'executed': True}, 'response_data': ''}" - # ], - # }, - # "env": {"OPENAI_API_KEY": OPENAI_API_KEY, "COMPOSIO_API_KEY": COMPOSIO_API_KEY}, - # }, + "praisonai": { + "plugin": "praisonai", + "file": PLUGINS / "praisonai" / "praisonai_demo.py", + "match": { + "type": "stdout", + "values": [ + "{'execution_details': {'executed': True}, 'response_data': ''}" + ], + }, + "env": {"OPENAI_API_KEY": OPENAI_API_KEY, "COMPOSIO_API_KEY": COMPOSIO_API_KEY}, + }, # TODO: Fix and add claude, camel } @@ -156,6 +167,10 @@ def test_example( example_name: str, example: dict # pylint: disable=unused-argument ) -> None: """Test an example with given environment.""" + plugin_to_test = os.getenv("PLUGIN_TO_TEST") + if plugin_to_test is not None and plugin_to_test != example["plugin"]: + pytest.skip(f"Skipping {example['plugin']}") + for key, val in example["env"].items(): assert ( val is not None