Skip to content

armgit / cua

Public Imported from GitHub
0

Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.

Remove old build scripts and update documentation with uv instructions

James Murdzac9aa66c655c9
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 346f2314fb..75980e2a84 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -35,12 +35,12 @@ We follow strict code formatting guidelines to ensure consistency across the cod
3. **Run Formatting Tools**: Always run the formatting tools before submitting a PR:
```bash
# For Python code
- pdm run black .
- pdm run ruff check --fix .
+ uv run black .
+ uv run ruff check --fix .
```
4. **Validate Your Code**: Ensure your code passes all checks:
```bash
- pdm run mypy .
+ uv run mypy .
```
## Documentation
diff --git a/Development.md b/Development.md
index 20484f80a4..55826dbf23 100644
--- a/Development.md
+++ b/Development.md
@@ -11,7 +11,7 @@ The project is organized as a monorepo with these main packages:
- `libs/computer-server/` - Server component for VM
- `libs/lume/` - Lume CLI
-Each package has its own virtual environment and dependencies, managed through PDM.
+These packages are part of a uv workspace which manages a shared virtual environment and dependencies.
## Local Development Setup
@@ -61,39 +61,33 @@ Refer to the [Lume README](./libs/lume/Development.md) for instructions on how t
## Python Development
-There are two ways to install Lume:
+### Setup
-### Run the build script
-
-Run the build script to set up all packages:
+Install all of workspace dependencies with a single command:
```bash
-./scripts/build.sh
+uv sync
```
-The build script creates a shared virtual environment for all packages. The workspace configuration automatically handles import paths with the correct Python path settings.
-
-This will:
+This installs all dependencies in the virtual environment `.venv`.
-- Create a virtual environment for the project
-- Install all packages in development mode
-- Set up the correct Python path
-- Install development tools
+Each Cua package is installed in editable mode, which means changes to the source code are immediately reflected in the installed package.
-### Install with PDM
+The `.venv` environment is also configured as the default VS Code Python interpreter in `.vscode/settings.json`.
-If PDM is not already installed, you can follow the installation instructions [here](https://pdm-project.org/en/latest/#installation).
+### Running Python Scripts
-To install with PDM, simply run:
+To run Python scripts in the workspace, use the `uv run` command:
-```console
-pdm install -G:all
+```bash
+uv run python examples/agent_examples.py
```
-This installs all the dependencies for development, testing, and building the docs. If you'd only like development dependencies, you can run:
+Or activate the virtual environment manually:
-```console
-pdm install -d
+```bash
+source .venv/bin/activate
+python examples/agent_examples.py
```
## Running Examples
@@ -172,7 +166,7 @@ This will:
- Remove all virtual environments
- Clean Python cache files and directories
- Remove build artifacts
-- Clean PDM-related files
+- Clean uv-related files
- Reset environment configurations
## Code Formatting Standards
@@ -255,13 +249,13 @@ To manually format code:
```bash
# Format all Python files using Black
-pdm run black .
+uv run black .
# Run Ruff linter with auto-fix
-pdm run ruff check --fix .
+uv run ruff check --fix .
# Run type checking with MyPy
-pdm run mypy .
+uv run mypy .
```
#### Pre-commit Validation
@@ -270,9 +264,9 @@ Before submitting a pull request, ensure your code passes all formatting checks:
```bash
# Run all checks
-pdm run black --check .
-pdm run ruff check .
-pdm run mypy .
+uv run black --check .
+uv run ruff check .
+uv run mypy .
```
### Swift Code (Lume)
diff --git a/scripts/build-uv.sh b/scripts/build-uv.sh
deleted file mode 100755
index f5df8a807d..0000000000
--- a/scripts/build-uv.sh
+++ /dev/null
@@ -1,104 +0,0 @@
-#!/bin/bash
-
-# Exit on error
-set -e
-
-# Colors for output
-RED='\033[0;31m'
-GREEN='\033[0;32m'
-BLUE='\033[0;34m'
-YELLOW='\033[1;33m'
-NC='\033[0m' # No Color
-
-# Function to print step information
-print_step() {
- echo -e "${BLUE}==> $1${NC}"
-}
-
-# Function to print success message
-print_success() {
- echo -e "${GREEN}==> Success: $1${NC}"
-}
-
-# Function to print error message
-print_error() {
- echo -e "${RED}==> Error: $1${NC}" >&2
-}
-
-# Function to print warning message
-print_warning() {
- echo -e "${YELLOW}==> Warning: $1${NC}"
-}
-
-# Function to check if UV is installed
-check_uv() {
- if command -v uv &> /dev/null; then
- print_success "UV is already installed"
- uv --version
- return 0
- else
- return 1
- fi
-}
-
-# Function to install UV
-install_uv() {
- print_step "UV not found. Installing UV..."
-
- # Detect OS
- if [[ "$OSTYPE" == "linux-gnu"* ]] || [[ "$OSTYPE" == "darwin"* ]]; then
- print_step "Installing UV for Unix-like system..."
- curl -LsSf https://astral.sh/uv/install.sh | sh
-
- # Add UV to PATH for current session
- export PATH="$HOME/.cargo/bin:$PATH"
-
- # Check if installation was successful
- if command -v uv &> /dev/null; then
- print_success "UV installed successfully"
- uv --version
- else
- print_error "UV installation failed"
- print_step "Please restart your terminal and try again, or install manually:"
- echo " curl -LsSf https://astral.sh/uv/install.sh | sh"
- exit 1
- fi
- elif [[ "$OSTYPE" == "msys" ]] || [[ "$OSTYPE" == "cygwin" ]]; then
- print_error "For Windows, please use PowerShell and run:"
- echo " powershell -ExecutionPolicy ByPass -c \"irm https://astral.sh/uv/install.ps1 | iex\""
- exit 1
- else
- print_error "Unsupported operating system: $OSTYPE"
- print_step "Please install UV manually from: https://docs.astral.sh/uv/getting-started/installation/"
- exit 1
- fi
-}
-
-# Get the script's directory
-SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
-PROJECT_ROOT="$( cd "${SCRIPT_DIR}/.." && pwd )"
-
-# Change to project root
-cd "$PROJECT_ROOT"
-
-# Check if UV is installed, install if not
-if ! check_uv; then
- install_uv
-fi
-
-# Create virtual environment using UV
-print_step "Creating virtual environment with UV..."
-rm -rf .venv
-uv venv .venv --python 3.13
-print_success "Virtual environment created"
-
-# Install packages
-print_step "Installing packages in development mode with UV..."
-uv sync --group dev
-
-# Print success
-print_success "All packages installed successfully with UV!"
-print_step "Your virtual environment is ready. To activate it:"
-echo " source .venv/bin/activate"
-print_step "UV provides fast dependency resolution and installation."
-print_step "You can also use 'uv run' to run commands in the virtual environment without activation."
diff --git a/scripts/build.ps1 b/scripts/build.ps1
deleted file mode 100644
index 13f613d75a..0000000000
--- a/scripts/build.ps1
+++ /dev/null
@@ -1,157 +0,0 @@
-# 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/python/core" "core")) { exit 1 }
-
-# Install pylume (base dependency)
-if (-not (Install-Package "libs/python/pylume" "pylume")) { exit 1 }
-
-# Install computer with all its dependencies and extras
-if (-not (Install-Package "libs/python/computer" "computer" "all")) { exit 1 }
-
-# Install omniparser
-if (-not (Install-Package "libs/python/som" "som")) { exit 1 }
-
-# Install agent with all its dependencies and extras
-if (-not (Install-Package "libs/python/agent" "agent" "all")) { exit 1 }
-
-# Install computer-server
-if (-not (Install-Package "libs/python/computer-server" "computer-server")) { exit 1 }
-
-# Install mcp-server
-if (-not (Install-Package "libs/python/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/python/core;$PROJECT_ROOT/libs/python/computer;$PROJECT_ROOT/libs/python/agent;$PROJECT_ROOT/libs/python/som;$PROJECT_ROOT/libs/python/pylume;$PROJECT_ROOT/libs/python/computer-server;$PROJECT_ROOT/libs/python/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
deleted file mode 100755
index f2850aaec0..0000000000
--- a/scripts/build.sh
+++ /dev/null
@@ -1,120 +0,0 @@
-#!/bin/bash
-
-# Exit on error
-set -e
-
-# Colors for output
-RED='\033[0;31m'
-GREEN='\033[0;32m'
-BLUE='\033[0;34m'
-NC='\033[0m' # No Color
-
-# Function to print step information
-print_step() {
- echo -e "${BLUE}==> $1${NC}"
-}
-
-# Function to print success message
-print_success() {
- echo -e "${GREEN}==> Success: $1${NC}"
-}
-
-# Function to print error message
-print_error() {
- echo -e "${RED}==> Error: $1${NC}" >&2
-}
-
-# Get the script's directory
-SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
-PROJECT_ROOT="$( cd "${SCRIPT_DIR}/.." && pwd )"
-
-# Change to project root
-cd "$PROJECT_ROOT"
-
-# Load environment variables from .env.local
-if [ -f .env.local ]; then
- print_step "Loading environment variables from .env.local..."
- set -a
- source .env.local
- set +a
- print_success "Environment variables loaded"
-else
- print_error ".env.local file not found"
- exit 1
-fi
-
-# Clean up existing environments and cache
-print_step "Cleaning up existing environments..."
-find . -type d -name "__pycache__" -exec rm -rf {} +
-find . -type d -name ".pytest_cache" -exec rm -rf {} +
-find . -type d -name "dist" -exec rm -rf {} +
-find . -type d -name ".venv" -exec rm -rf {} +
-find . -type d -name "*.egg-info" -exec rm -rf {} +
-print_success "Environment cleanup complete"
-
-# Create and activate virtual environment
-print_step "Creating virtual environment..."
-python -m venv .venv
-source .venv/bin/activate
-
-# Upgrade pip and install build tools
-print_step "Upgrading pip and installing build tools..."
-python -m pip install --upgrade pip setuptools wheel
-
-# Function to install a package and its dependencies
-install_package() {
- local package_dir=$1
- local package_name=$2
- local extras=$3
- print_step "Installing ${package_name}..."
- cd "$package_dir"
-
- if [ -f "pyproject.toml" ]; then
- if [ -n "$extras" ]; then
- pip install -e ".[${extras}]"
- else
- pip install -e .
- fi
- else
- print_error "No pyproject.toml found in ${package_dir}"
- return 1
- fi
-
- cd "$PROJECT_ROOT"
-}
-
-# Install packages in order of dependency
-print_step "Installing packages in development mode..."
-
-# Install core first (base package with telemetry support)
-install_package "libs/python/core" "core"
-
-# Install pylume (base dependency)
-install_package "libs/python/pylume" "pylume"
-
-# Install computer with all its dependencies and extras
-install_package "libs/python/computer" "computer" "all"
-
-# Install omniparser
-install_package "libs/python/som" "som"
-
-# Install agent with all its dependencies and extras
-install_package "libs/python/agent" "agent" "all"
-
-# Install computer-server
-install_package "libs/python/computer-server" "computer-server"
-
-# Install mcp-server
-install_package "libs/python/mcp-server" "mcp-server"
-
-# 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..."
-echo "PYTHONPATH=${PROJECT_ROOT}/libs/python/core:${PROJECT_ROOT}/libs/python/computer:${PROJECT_ROOT}/libs/python/agent:${PROJECT_ROOT}/libs/python/som:${PROJECT_ROOT}/libs/python/pylume:${PROJECT_ROOT}/libs/python/computer-server:${PROJECT_ROOT}/libs/python/mcp-server" > .env
-
-print_success "All packages installed successfully!"
-print_step "Your virtual environment is ready. To activate it:"
-echo " source .venv/bin/activate"
diff --git a/scripts/cleanup.sh b/scripts/cleanup.sh
deleted file mode 100755
index aca894f68a..0000000000
--- a/scripts/cleanup.sh
+++ /dev/null
@@ -1,90 +0,0 @@
-#!/bin/bash
-
-# Exit on error
-set -e
-
-# Colors for output
-RED='\033[0;31m'
-GREEN='\033[0;32m'
-BLUE='\033[0;34m'
-NC='\033[0m' # No Color
-
-# Function to print step information
-print_step() {
- echo -e "${BLUE}==> $1${NC}"
-}
-
-# Function to print success message
-print_success() {
- echo -e "${GREEN}==> Success: $1${NC}"
-}
-
-# Function to print error message
-print_error() {
- echo -e "${RED}==> Error: $1${NC}" >&2
-}
-
-# Get the script's directory
-SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
-PROJECT_ROOT="$SCRIPT_DIR/.."
-
-# Change to project root
-cd "$PROJECT_ROOT"
-
-print_step "Starting cleanup of all caches and virtual environments..."
-
-# Remove all virtual environments
-print_step "Removing virtual environments..."
-find . -type d -name ".venv" -exec rm -rf {} +
-print_success "Virtual environments removed"
-
-# Remove all Python cache files and directories
-print_step "Removing Python cache files and directories..."
-find . -type d -name "__pycache__" -exec rm -rf {} +
-find . -type d -name ".pytest_cache" -exec rm -rf {} +
-find . -type d -name ".mypy_cache" -exec rm -rf {} +
-find . -type d -name ".ruff_cache" -exec rm -rf {} +
-find . -name "*.pyc" -delete
-find . -name "*.pyo" -delete
-find . -name "*.pyd" -delete
-print_success "Python cache files removed"
-
-# Remove all build artifacts
-print_step "Removing build artifacts..."
-find . -type d -name "build" -exec rm -rf {} +
-find . -type d -name "dist" -exec rm -rf {} +
-find . -type d -name "*.egg-info" -exec rm -rf {} +
-find . -type d -name "*.egg" -exec rm -rf {} +
-print_success "Build artifacts removed"
-
-# Remove PDM-related files and directories
-print_step "Removing PDM-related files and directories..."
-find . -name "pdm.lock" -delete
-find . -type d -name ".pdm-build" -exec rm -rf {} +
-find . -name ".pdm-python" -delete # .pdm-python is a file, not a directory
-print_success "PDM-related files removed"
-
-# Remove MCP-related files
-print_step "Removing MCP-related files..."
-find . -name "mcp_server.log" -delete
-print_success "MCP-related files removed"
-
-# Remove .env file
-print_step "Removing .env file..."
-rm -f .env
-print_success ".env file removed"
-
-# Remove typings directory
-print_step "Removing typings directory..."
-rm -rf .vscode/typings
-print_success "Typings directory removed"
-
-# Clean up any temporary files
-print_step "Removing temporary files..."
-find . -name "*.tmp" -delete
-find . -name "*.bak" -delete
-find . -name "*.swp" -delete
-print_success "Temporary files removed"
-
-print_success "Cleanup complete! All caches and virtual environments have been removed."
-print_step "To rebuild the project, run: bash scripts/build.sh"