diff --git a/.github/workflows/pypi-publish-pylume.yml b/.github/workflows/pypi-publish-pylume.yml deleted file mode 100644 index 91278c00..00000000 --- a/.github/workflows/pypi-publish-pylume.yml +++ /dev/null @@ -1,82 +0,0 @@ -name: Publish Pylume Package - -on: - push: - tags: - - "pylume-v*" - workflow_dispatch: - inputs: - version: - description: "Version to publish (without v prefix)" - required: true - default: "0.1.0" - workflow_call: - inputs: - version: - description: "Version to publish" - required: true - type: string - outputs: - version: - description: "The version that was published" - value: ${{ jobs.determine-version.outputs.version }} - -# Adding permissions at workflow level -permissions: - contents: write - -jobs: - determine-version: - runs-on: macos-latest - outputs: - version: ${{ steps.get-version.outputs.version }} - steps: - - uses: actions/checkout@v4 - - - name: Determine version - id: get-version - run: | - if [ "${{ github.event_name }}" == "push" ]; then - # Extract version from tag (for package-specific tags) - if [[ "${{ github.ref }}" =~ ^refs/tags/pylume-v([0-9]+\.[0-9]+\.[0-9]+) ]]; then - VERSION=${BASH_REMATCH[1]} - else - echo "Invalid tag format for pylume" - exit 1 - fi - elif [ "${{ github.event_name }}" == "workflow_dispatch" ]; then - # Use version from workflow dispatch - VERSION=${{ github.event.inputs.version }} - else - # Use version from workflow_call - VERSION=${{ inputs.version }} - fi - echo "VERSION=$VERSION" - echo "version=$VERSION" >> $GITHUB_OUTPUT - - validate-version: - runs-on: macos-latest - needs: determine-version - steps: - - uses: actions/checkout@v4 - - name: Validate version - id: validate-version - run: | - CODE_VERSION=$(grep '__version__' libs/python/pylume/pylume/__init__.py | cut -d'"' -f2) - if [ "${{ needs.determine-version.outputs.version }}" != "$CODE_VERSION" ]; then - echo "Version mismatch: expected $CODE_VERSION, got ${{ needs.determine-version.outputs.version }}" - exit 1 - fi - echo "Version validated: $CODE_VERSION" - - publish: - needs: determine-version - uses: ./.github/workflows/pypi-reusable-publish.yml - with: - package_name: "pylume" - package_dir: "libs/python/pylume" - version: ${{ needs.determine-version.outputs.version }} - is_lume_package: true - base_package_name: "pylume" - secrets: - PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} diff --git a/.github/workflows/pypi-reusable-publish.yml b/.github/workflows/pypi-reusable-publish.yml index 4a220610..614d8a7d 100644 --- a/.github/workflows/pypi-reusable-publish.yml +++ b/.github/workflows/pypi-reusable-publish.yml @@ -4,11 +4,11 @@ on: workflow_call: inputs: package_name: - description: "Name of the package (e.g. pylume, computer, agent)" + description: "Name of the package (e.g. computer, agent)" required: true type: string package_dir: - description: "Directory containing the package relative to workspace root (e.g. libs/python/pylume)" + description: "Directory containing the package relative to workspace root (e.g. libs/python/computer)" required: true type: string version: @@ -21,7 +21,7 @@ on: type: boolean default: false base_package_name: - description: "PyPI package name (e.g. pylume, cua-agent)" + description: "PyPI package name (e.g. cua-agent)" required: true type: string make_latest: diff --git a/.vscode/launch.json b/.vscode/launch.json index acfd84b2..58701566 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -10,7 +10,7 @@ "python": "${workspaceFolder:cua-root}/.venv/bin/python", "cwd": "${workspaceFolder:cua-root}", "env": { - "PYTHONPATH": "${workspaceFolder:cua-root}/libs/python/core:${workspaceFolder:cua-root}/libs/python/computer:${workspaceFolder:cua-root}/libs/python/agent:${workspaceFolder:cua-root}/libs/python/som:${workspaceFolder:cua-root}/libs/python/pylume" + "PYTHONPATH": "${workspaceFolder:cua-root}/libs/python/core:${workspaceFolder:cua-root}/libs/python/computer:${workspaceFolder:cua-root}/libs/python/agent:${workspaceFolder:cua-root}/libs/python/som" } }, { @@ -23,7 +23,7 @@ "python": "${workspaceFolder:cua-root}/.venv/bin/python", "cwd": "${workspaceFolder:cua-root}", "env": { - "PYTHONPATH": "${workspaceFolder:cua-root}/libs/python/core:${workspaceFolder:cua-root}/libs/python/computer:${workspaceFolder:cua-root}/libs/python/agent:${workspaceFolder:cua-root}/libs/python/som:${workspaceFolder:cua-root}/libs/python/pylume" + "PYTHONPATH": "${workspaceFolder:cua-root}/libs/python/core:${workspaceFolder:cua-root}/libs/python/computer:${workspaceFolder:cua-root}/libs/python/agent:${workspaceFolder:cua-root}/libs/python/som" } }, { @@ -36,7 +36,7 @@ "python": "${workspaceFolder:cua-root}/.venv/bin/python", "cwd": "${workspaceFolder:cua-root}", "env": { - "PYTHONPATH": "${workspaceFolder:cua-root}/libs/python/core:${workspaceFolder:cua-root}/libs/python/computer:${workspaceFolder:cua-root}/libs/python/agent:${workspaceFolder:cua-root}/libs/python/som:${workspaceFolder:cua-root}/libs/python/pylume" + "PYTHONPATH": "${workspaceFolder:cua-root}/libs/python/core:${workspaceFolder:cua-root}/libs/python/computer:${workspaceFolder:cua-root}/libs/python/agent:${workspaceFolder:cua-root}/libs/python/som" } }, { @@ -49,20 +49,7 @@ "python": "${workspaceFolder:cua-root}/.venv/bin/python", "cwd": "${workspaceFolder:cua-root}", "env": { - "PYTHONPATH": "${workspaceFolder:cua-root}/libs/python/core:${workspaceFolder:cua-root}/libs/python/computer:${workspaceFolder:cua-root}/libs/python/agent:${workspaceFolder:cua-root}/libs/python/som:${workspaceFolder:cua-root}/libs/python/pylume" - } - }, - { - "name": "Run PyLume Examples", - "type": "debugpy", - "request": "launch", - "program": "examples/pylume_examples.py", - "console": "integratedTerminal", - "justMyCode": true, - "python": "${workspaceFolder:cua-root}/.venv/bin/python", - "cwd": "${workspaceFolder:cua-root}", - "env": { - "PYTHONPATH": "${workspaceFolder:cua-root}/libs/python/core:${workspaceFolder:cua-root}/libs/python/computer:${workspaceFolder:cua-root}/libs/python/agent:${workspaceFolder:cua-root}/libs/python/som:${workspaceFolder:cua-root}/libs/python/pylume" + "PYTHONPATH": "${workspaceFolder:cua-root}/libs/python/core:${workspaceFolder:cua-root}/libs/python/computer:${workspaceFolder:cua-root}/libs/python/agent:${workspaceFolder:cua-root}/libs/python/som" } }, { @@ -84,7 +71,7 @@ "python": "${workspaceFolder:cua-root}/.venv/bin/python", "cwd": "${workspaceFolder:cua-root}", "env": { - "PYTHONPATH": "${workspaceFolder:cua-root}/libs/python/core:${workspaceFolder:cua-root}/libs/python/computer:${workspaceFolder:cua-root}/libs/python/agent:${workspaceFolder:cua-root}/libs/python/som:${workspaceFolder:cua-root}/libs/python/pylume" + "PYTHONPATH": "${workspaceFolder:cua-root}/libs/python/core:${workspaceFolder:cua-root}/libs/python/computer:${workspaceFolder:cua-root}/libs/python/agent:${workspaceFolder:cua-root}/libs/python/som" } }, { @@ -106,7 +93,7 @@ "python": "${workspaceFolder:cua-root}/.venv/bin/python", "cwd": "${workspaceFolder:cua-root}", "env": { - "PYTHONPATH": "${workspaceFolder:cua-root}/libs/python/core:${workspaceFolder:cua-root}/libs/python/computer:${workspaceFolder:cua-root}/libs/python/agent:${workspaceFolder:cua-root}/libs/python/som:${workspaceFolder:cua-root}/libs/python/pylume" + "PYTHONPATH": "${workspaceFolder:cua-root}/libs/python/core:${workspaceFolder:cua-root}/libs/python/computer:${workspaceFolder:cua-root}/libs/python/agent:${workspaceFolder:cua-root}/libs/python/som" } }, { @@ -119,7 +106,7 @@ "python": "${workspaceFolder:cua-root}/.venv/bin/python", "cwd": "${workspaceFolder:cua-root}", "env": { - "PYTHONPATH": "${workspaceFolder:cua-root}/libs/python/core:${workspaceFolder:cua-root}/libs/python/computer:${workspaceFolder:cua-root}/libs/python/agent:${workspaceFolder:cua-root}/libs/python/som:${workspaceFolder:cua-root}/libs/python/pylume" + "PYTHONPATH": "${workspaceFolder:cua-root}/libs/python/core:${workspaceFolder:cua-root}/libs/python/computer:${workspaceFolder:cua-root}/libs/python/agent:${workspaceFolder:cua-root}/libs/python/som" } }, { diff --git a/.vscode/py.code-workspace b/.vscode/py.code-workspace index 25324251..adb04695 100644 --- a/.vscode/py.code-workspace +++ b/.vscode/py.code-workspace @@ -20,10 +20,6 @@ "name": "computer-server", "path": "../libs/python/computer-server" }, - { - "name": "pylume", - "path": "../libs/python/pylume" - }, { "name": "core", "path": "../libs/python/core" @@ -51,7 +47,6 @@ "${workspaceFolder:cua-root}/libs/python/computer", "${workspaceFolder:cua-root}/libs/python/agent", "${workspaceFolder:cua-root}/libs/python/som", - "${workspaceFolder:cua-root}/libs/python/pylume", "${workspaceFolder:cua-root}/.vscode/typings" ], "python.envFile": "${workspaceFolder:cua-root}/.env", @@ -89,10 +84,6 @@ "name": "som", "depth": 2 }, - { - "name": "pylume", - "depth": 2 - }, { "name": "core", "depth": 2 @@ -103,7 +94,6 @@ "${workspaceFolder:cua-root}/libs/python/computer", "${workspaceFolder:cua-root}/libs/python/agent", "${workspaceFolder:cua-root}/libs/python/som", - "${workspaceFolder:cua-root}/libs/python/pylume" ], "python.languageServer": "None", "[python]": { diff --git a/Dockerfile b/Dockerfile index 9b9f3c47..579842a4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,7 +5,7 @@ ENV PYTHONUNBUFFERED=1 \ PYTHONDONTWRITEBYTECODE=1 \ PIP_NO_CACHE_DIR=1 \ PIP_DISABLE_PIP_VERSION_CHECK=1 \ - PYTHONPATH="/app/libs/python/core:/app/libs/python/computer:/app/libs/python/agent:/app/libs/python/som:/app/libs/python/pylume:/app/libs/python/computer-server:/app/libs/python/mcp-server" + PYTHONPATH="/app/libs/python/core:/app/libs/python/computer:/app/libs/python/agent:/app/libs/python/som:/app/libs/python/computer-server:/app/libs/python/mcp-server" # Install system dependencies for ARM architecture RUN apt-get update && apt-get install -y --no-install-recommends \ diff --git a/libs/python/pylume/pylume/lume b/libs/python/pylume/pylume/lume deleted file mode 100755 index 5ea1be47..00000000 Binary files a/libs/python/pylume/pylume/lume and /dev/null differ diff --git a/notebooks/README.md b/notebooks/README.md index e0a18cd3..fb70230d 100644 --- a/notebooks/README.md +++ b/notebooks/README.md @@ -8,7 +8,6 @@ This folder contains Jupyter notebooks that demonstrate the core functionality o - **`computer_nb.ipynb`** - Demonstrates the Computer API for programmatically operating sandbox VMs using either Cua Cloud Sandbox or local Lume VMs on Apple Silicon macOS systems - **`agent_nb.ipynb`** - Shows how to use CUA's Agent to run automated workflows in virtual sandboxes with various AI models (OpenAI, Anthropic, local models) -- **`pylume_nb.ipynb`** - Quickstart guide for the pylume Python library, which handles VM creation, management, and image operations - **`computer_server_nb.ipynb`** - Demonstrates how to host and configure the Computer server that powers the Computer API ### Evaluation & Benchmarking diff --git a/notebooks/pylume_nb.ipynb b/notebooks/pylume_nb.ipynb deleted file mode 100644 index 1b504417..00000000 --- a/notebooks/pylume_nb.ipynb +++ /dev/null @@ -1,357 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Intro\n", - "\n", - "This notebook provides a quickstart guide to the pylume python library." - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "!pip uninstall pylume -y" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "!pip install pylume" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "!pip install pydantic" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "# If locally installed, use this instead:\n", - "# !poetry install\n", - "# !poetry build\n", - "!pip uninstall pylume -y && pip install ./dist/pylume-0.1.0-py3-none-any.whl --force-reinstall" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": {}, - "outputs": [], - "source": [ - "import asyncio\n", - "from pylume import (\n", - " PyLume, \n", - " ImageRef, \n", - " VMRunOpts, \n", - " SharedDirectory, \n", - " VMConfig,\n", - " VMUpdateOpts\n", - ")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "### Get latest IPSW URL from Apple Server\n", - "\n", - "This is used to create a new macOS VM by providing the downloaded IPSW file path to the `ipsw` argument in the `create_vm` method." - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "async def get_ipsw():\n", - " async with PyLume(port=7777) as pylume:\n", - " url = await pylume.get_latest_ipsw_url()\n", - " print(f\"Latest IPSW URL: {url}\")\n", - "\n", - "await get_ipsw()" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "### Create a new VM" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "#### macOS\n", - "\n", - "An IPSW file path is required to create a new macOS VM. To fetch automatically the latest IPSW during the VM creation, use `ipsw=\"latest\"`." - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "async def create_macos_vm():\n", - " async with PyLume() as pylume:\n", - " vm_config = VMConfig(\n", - " name=\"macos-vm\",\n", - " os=\"macOS\",\n", - " cpu=4,\n", - " memory=\"4GB\",\n", - " disk_size=\"40GB\",\n", - " display=\"1024x768\",\n", - " ipsw=\"latest\"\n", - " )\n", - " await pylume.create_vm(vm_config)\n", - "\n", - "await create_macos_vm()" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "#### Linux\n", - "\n", - "To create a new Linux VM, use the `os=\"linux\"` argument in the `VMConfig` class. Note that this doesn't set up any Linux distribution, it just creates a VM with a Linux kernel." - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "async def create_linux_vm():\n", - " async with PyLume() as pylume:\n", - " vm_config = VMConfig(\n", - " name=\"linux-vm\",\n", - " os=\"linux\",\n", - " cpu=2,\n", - " memory=\"4GB\",\n", - " disk_size=\"25GB\",\n", - " display=\"1024x768\"\n", - " )\n", - " await pylume.create_vm(vm_config)\n", - "\n", - "await create_linux_vm()" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "### Pull an image from ghcr.io/trycua" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "Cua provides pre-built images for macOS and Linux." - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "async def pull_macos_image():\n", - " async with PyLume() as pylume:\n", - " image_ref = ImageRef(\n", - " image=\"macos-sequoia-vanilla\",\n", - " tag=\"15.2\",\n", - " registry=\"ghcr.io\",\n", - " organization=\"trycua\"\n", - " )\n", - " await pylume.pull_image(image_ref, name=\"macos-sequoia-vanilla\")\n", - "\n", - "await pull_macos_image()" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "### Run\n", - "\n", - "Run a VM by providing the `VMRunConfig` object." - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "async def run_vm():\n", - " async with PyLume() as pylume:\n", - " vm_name = \"macos-sequoia-vanilla\"\n", - " run_opts = VMRunOpts(\n", - " no_display=False,\n", - " shared_directories=[\n", - " SharedDirectory(\n", - " host_path=\"/Users//Shared\",\n", - " read_only=False\n", - " )\n", - " ]\n", - " )\n", - " await pylume.run_vm(vm_name, run_opts)\n", - "\n", - "await run_vm()" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "### List existing VMs\n", - "\n", - "VMs are stored in the `~/.lume` directory." - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "async with PyLume() as pylume:\n", - " vms = await pylume.list_vms()" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "### Get VM status" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "async with PyLume() as pylume:\n", - " status = await pylume.get_vm(\"macos-sequoia-vanilla\")\n", - " print(status)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "### Update VM Settings" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "update_config = VMUpdateOpts(\n", - " cpu=8,\n", - " memory=\"8GB\"\n", - ")\n", - "async with PyLume() as pylume:\n", - " await pylume.update_vm(\"macos-sequoia-vanilla\", update_config)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "### Stop a VM" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "async with PyLume() as pylume:\n", - " await pylume.stop_vm(\"macos-sequoia-vanilla\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "### Delete a VM" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "async with PyLume() as pylume:\n", - " await pylume.delete_vm(\"linux-vm\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "### Images\n", - "\n", - "List the images available locally" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "async with PyLume() as pylume:\n", - " await pylume.get_images()" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "cua", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.11.11" - } - }, - "nbformat": 4, - "nbformat_minor": 2 -} diff --git a/scripts/run-docker-dev.sh b/scripts/run-docker-dev.sh index e4aab8ea..ef066798 100755 --- a/scripts/run-docker-dev.sh +++ b/scripts/run-docker-dev.sh @@ -43,7 +43,7 @@ else fi # Environment variables -PYTHONPATH="/app/libs/python/core:/app/libs/python/computer:/app/libs/python/agent:/app/libs/python/som:/app/libs/python/pylume:/app/libs/python/computer-server:/app/libs/python/mcp-server" +PYTHONPATH="/app/libs/python/core:/app/libs/python/computer:/app/libs/python/agent:/app/libs/python/som:/app/libs/python/computer-server:/app/libs/python/mcp-server" # Check if Docker is installed if ! command -v docker &> /dev/null; then