From 15cfd4d3e4a1d2b4d74607606beaa47b40b3b296 Mon Sep 17 00:00:00 2001 From: Dillon DuPont Date: Mon, 23 Jun 2025 12:32:29 -0400 Subject: [PATCH 1/2] Update dependencies for agent and computer libs --- libs/agent/pyproject.toml | 70 ++++++++++++++++++------------------ libs/computer/pyproject.toml | 12 +++---- 2 files changed, 41 insertions(+), 41 deletions(-) diff --git a/libs/agent/pyproject.toml b/libs/agent/pyproject.toml index f078a5c9..a87d72b6 100644 --- a/libs/agent/pyproject.toml +++ b/libs/agent/pyproject.toml @@ -11,14 +11,14 @@ authors = [ { name = "TryCua", email = "gh@trycua.com" } ] dependencies = [ - "httpx>=0.27.0,<0.29.0", - "aiohttp>=3.9.3,<4.0.0", + "httpx>=0.27.0", + "aiohttp>=3.9.3", "asyncio", - "anyio>=4.4.1,<5.0.0", - "typing-extensions>=4.12.2,<5.0.0", - "pydantic>=2.6.4,<3.0.0", - "rich>=13.7.1,<14.0.0", - "python-dotenv>=1.0.1,<2.0.0", + "anyio>=4.4.1", + "typing-extensions>=4.12.2", + "pydantic>=2.6.4", + "rich>=13.7.1", + "python-dotenv>=1.0.1", "cua-computer>=0.2.0,<0.3.0", "cua-core>=0.1.0,<0.2.0", "certifi>=2024.2.2" @@ -28,21 +28,21 @@ requires-python = ">=3.11" [project.optional-dependencies] anthropic = [ "anthropic>=0.49.0", - "boto3>=1.35.81,<2.0.0", + "boto3>=1.35.81", ] openai = [ - "openai>=1.14.0,<2.0.0", - "httpx>=0.27.0,<0.29.0", + "openai>=1.14.0", + "httpx>=0.27.0", ] uitars = [ - "httpx>=0.27.0,<0.29.0", + "httpx>=0.27.0", ] uitars-mlx = [ "mlx-vlm>=0.1.27; sys_platform == 'darwin'" ] ui = [ - "gradio>=5.23.3,<6.0.0", - "python-dotenv>=1.0.1,<2.0.0", + "gradio>=5.23.3", + "python-dotenv>=1.0.1", ] som = [ "torch>=2.2.1", @@ -51,12 +51,12 @@ som = [ "transformers>=4.38.2", "cua-som>=0.1.0,<0.2.0", # Include all provider dependencies - "anthropic>=0.46.0,<0.47.0", - "boto3>=1.35.81,<2.0.0", - "openai>=1.14.0,<2.0.0", - "groq>=0.4.0,<0.5.0", - "dashscope>=1.13.0,<2.0.0", - "requests>=2.31.0,<3.0.0" + "anthropic>=0.46.0", + "boto3>=1.35.81", + "openai>=1.14.0", + "groq>=0.4.0", + "dashscope>=1.13.0", + "requests>=2.31.0" ] omni = [ "torch>=2.2.1", @@ -64,13 +64,13 @@ omni = [ "ultralytics>=8.0.0", "transformers>=4.38.2", "cua-som>=0.1.0,<0.2.0", - "anthropic>=0.46.0,<0.47.0", - "boto3>=1.35.81,<2.0.0", - "openai>=1.14.0,<2.0.0", - "groq>=0.4.0,<0.5.0", - "dashscope>=1.13.0,<2.0.0", - "requests>=2.31.0,<3.0.0", - "ollama>=0.4.7,<0.5.0" + "anthropic>=0.46.0", + "boto3>=1.35.81", + "openai>=1.14.0", + "groq>=0.4.0", + "dashscope>=1.13.0", + "requests>=2.31.0", + "ollama>=0.4.7" ] all = [ # Include all optional dependencies @@ -79,15 +79,15 @@ all = [ "ultralytics>=8.0.0", "transformers>=4.38.2", "cua-som>=0.1.0,<0.2.0", - "anthropic>=0.46.0,<0.47.0", - "boto3>=1.35.81,<2.0.0", - "openai>=1.14.0,<2.0.0", - "groq>=0.4.0,<0.5.0", - "dashscope>=1.13.0,<2.0.0", - "requests>=2.31.0,<3.0.0", - "ollama>=0.4.7,<0.5.0", - "gradio>=5.23.3,<6.0.0", - "python-dotenv>=1.0.1,<2.0.0", + "anthropic>=0.46.0", + "boto3>=1.35.81", + "openai>=1.14.0", + "groq>=0.4.0", + "dashscope>=1.13.0", + "requests>=2.31.0", + "ollama>=0.4.7", + "gradio>=5.23.3", + "python-dotenv>=1.0.1", "mlx-vlm>=0.1.27; sys_platform == 'darwin'" ] diff --git a/libs/computer/pyproject.toml b/libs/computer/pyproject.toml index 04bd2dfb..4326eb98 100644 --- a/libs/computer/pyproject.toml +++ b/libs/computer/pyproject.toml @@ -26,15 +26,15 @@ lume = [ lumier = [ ] ui = [ - "gradio>=5.23.3,<6.0.0", - "python-dotenv>=1.0.1,<2.0.0", - "datasets>=3.6.0,<4.0.0", + "gradio>=5.23.3", + "python-dotenv>=1.0.1", + "datasets>=3.6.0", ] all = [ # Include all optional dependencies - "gradio>=5.23.3,<6.0.0", - "python-dotenv>=1.0.1,<2.0.0", - "datasets>=3.6.0,<4.0.0", + "gradio>=5.23.3", + "python-dotenv>=1.0.1", + "datasets>=3.6.0", ] [tool.pdm] From 54d585e174e03912f982dcc7b913dddd0718813d Mon Sep 17 00:00:00 2001 From: Dillon DuPont Date: Mon, 23 Jun 2025 12:38:25 -0400 Subject: [PATCH 2/2] Added build.ps1 and computer[all] installation step --- scripts/build.ps1 | 157 ++++++++++++++++++++++++++++++++++++++++++++++ scripts/build.sh | 4 +- 2 files changed, 159 insertions(+), 2 deletions(-) create mode 100644 scripts/build.ps1 diff --git a/scripts/build.ps1 b/scripts/build.ps1 new file mode 100644 index 00000000..8c2c99c2 --- /dev/null +++ b/scripts/build.ps1 @@ -0,0 +1,157 @@ +# PowerShell Build Script for CUA +# Exit on error +$ErrorActionPreference = "Stop" + +# Colors for output +$RED = "Red" +$GREEN = "Green" +$BLUE = "Blue" + +# Function to print step information +function Print-Step { + param([string]$Message) + Write-Host "==> $Message" -ForegroundColor $BLUE +} + +# Function to print success message +function Print-Success { + param([string]$Message) + Write-Host "==> Success: $Message" -ForegroundColor $GREEN +} + +# Function to print error message +function Print-Error { + param([string]$Message) + Write-Host "==> Error: $Message" -ForegroundColor $RED +} + +# Get the script's directory and project root +$SCRIPT_DIR = Split-Path -Parent $MyInvocation.MyCommand.Path +$PROJECT_ROOT = Split-Path -Parent $SCRIPT_DIR + +# Change to project root +Set-Location $PROJECT_ROOT + +# Load environment variables from .env.local +if (Test-Path ".env.local") { + Print-Step "Loading environment variables from .env.local..." + Get-Content ".env.local" | ForEach-Object { + if ($_ -match "^([^#][^=]*?)=(.*)$") { + [Environment]::SetEnvironmentVariable($matches[1], $matches[2], "Process") + } + } + Print-Success "Environment variables loaded" +} else { + Print-Error ".env.local file not found" + exit 1 +} + +# Check if conda is available +try { + conda --version | Out-Null + Print-Success "Conda is available" +} catch { + Print-Error "Conda is not available. Please install Anaconda or Miniconda first." + exit 1 +} + +# Create or update conda environment +Print-Step "Creating/updating conda environment 'cua' with Python 3.12..." +try { + # Check if environment exists + $envExists = conda env list | Select-String "^cua\s" + if ($envExists) { + Print-Step "Environment 'cua' already exists. Updating..." + conda env update -n cua -f environment.yml --prune + } else { + Print-Step "Creating new environment 'cua'..." + conda create -n cua python=3.12 -y + } + Print-Success "Conda environment 'cua' ready" +} catch { + Print-Error "Failed to create/update conda environment" + exit 1 +} + +# Activate conda environment +Print-Step "Activating conda environment 'cua'..." +try { + conda activate cua + Print-Success "Environment activated" +} catch { + Print-Error "Failed to activate conda environment 'cua'" + Print-Step "Please run: conda activate cua" + Print-Step "Then re-run this script" + exit 1 +} + +# Clean up existing environments and cache +Print-Step "Cleaning up existing environments..." +Get-ChildItem -Path . -Recurse -Directory -Name "__pycache__" | ForEach-Object { Remove-Item -Path $_ -Recurse -Force } +Get-ChildItem -Path . -Recurse -Directory -Name ".pytest_cache" | ForEach-Object { Remove-Item -Path $_ -Recurse -Force } +Get-ChildItem -Path . -Recurse -Directory -Name "dist" | ForEach-Object { Remove-Item -Path $_ -Recurse -Force } +Get-ChildItem -Path . -Recurse -Directory -Name "*.egg-info" | ForEach-Object { Remove-Item -Path $_ -Recurse -Force } + +# Function to install a package and its dependencies +function Install-Package { + param( + [string]$PackageDir, + [string]$PackageName, + [string]$Extras = "" + ) + + Print-Step "Installing $PackageName..." + Set-Location $PackageDir + + if (Test-Path "pyproject.toml") { + if ($Extras) { + pip install -e ".[$Extras]" + } else { + pip install -e . + } + } else { + Print-Error "No pyproject.toml found in $PackageDir" + Set-Location $PROJECT_ROOT + return $false + } + + Set-Location $PROJECT_ROOT + return $true +} + +# Install packages in order of dependency +Print-Step "Installing packages in development mode..." + +# Install core first (base package with telemetry support) +if (-not (Install-Package "libs/core" "core")) { exit 1 } + +# Install pylume (base dependency) +if (-not (Install-Package "libs/pylume" "pylume")) { exit 1 } + +# Install computer with all its dependencies and extras +if (-not (Install-Package "libs/computer" "computer" "all")) { exit 1 } + +# Install omniparser +if (-not (Install-Package "libs/som" "som")) { exit 1 } + +# Install agent with all its dependencies and extras +if (-not (Install-Package "libs/agent" "agent" "all")) { exit 1 } + +# Install computer-server +if (-not (Install-Package "libs/computer-server" "computer-server")) { exit 1 } + +# Install mcp-server +if (-not (Install-Package "libs/mcp-server" "mcp-server")) { exit 1 } + +# Install development tools from root project +Print-Step "Installing development dependencies..." +pip install -e ".[dev,test,docs]" + +# Create a .env file for VS Code to use the virtual environment +Print-Step "Creating .env file for VS Code..." +$pythonPath = "$PROJECT_ROOT/libs/core;$PROJECT_ROOT/libs/computer;$PROJECT_ROOT/libs/agent;$PROJECT_ROOT/libs/som;$PROJECT_ROOT/libs/pylume;$PROJECT_ROOT/libs/computer-server;$PROJECT_ROOT/libs/mcp-server" +"PYTHONPATH=$pythonPath" | Out-File -FilePath ".env" -Encoding UTF8 + +Print-Success "All packages installed successfully!" +Print-Step "Your conda environment 'cua' is ready. To activate it:" +Write-Host " conda activate cua" -ForegroundColor Yellow diff --git a/scripts/build.sh b/scripts/build.sh index 5d747816..19021423 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -92,8 +92,8 @@ install_package "libs/core" "core" # Install pylume (base dependency) install_package "libs/pylume" "pylume" -# Install computer (depends on pylume) -install_package "libs/computer" "computer" +# Install computer with all its dependencies and extras +install_package "libs/computer" "computer" "all" # Install omniparser install_package "libs/som" "som"