mirror of
https://github.com/trycua/computer.git
synced 2025-12-31 10:29:59 -06:00
Merge branch 'main' into feature/computer/typescript
This commit is contained in:
@@ -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'"
|
||||
]
|
||||
|
||||
|
||||
@@ -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]
|
||||
|
||||
157
scripts/build.ps1
Normal file
157
scripts/build.ps1
Normal file
@@ -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
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user