Add dev container, fix lints

This commit is contained in:
f-trycua
2025-03-19 23:28:38 +01:00
parent 13d9ec516d
commit afce3b9e66
45 changed files with 1033 additions and 1889 deletions

View File

@@ -4,24 +4,29 @@
The project is organized as a monorepo with these main packages:
- `libs/core/` - Base package with telemetry support
- `libs/pylume/` - Python bindings for Lume
- `libs/computer/` - Core computer interaction library
- `libs/computer/` - Computer-use interface (CUI) library
- `libs/agent/` - AI agent library with multi-provider support
- `libs/som/` - Computer vision and NLP processing library (formerly omniparser)
- `libs/computer-server/` - Server implementation for computer control
- `libs/lume/` - Swift implementation for enhanced macOS integration
- `libs/som/` - Set-of-Mark parser
- `libs/computer-server/` - Server component for VM
- `libs/lume/` - Lume CLI
- `libs/pylume/` - Python bindings for Lume
Each package has its own virtual environment and dependencies, managed through PDM.
### Local Development Setup
1. Clone the repository:
1. Install Lume CLI:
```bash
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/trycua/cua/main/libs/lume/scripts/install.sh)"
```
2. Clone the repository:
```bash
git clone https://github.com/trycua/cua.git
cd cua
```
2. Create a `.env.local` file in the root directory with your API keys:
3. Create a `.env.local` file in the root directory with your API keys:
```bash
# Required for Anthropic provider
ANTHROPIC_API_KEY=your_anthropic_key_here
@@ -30,7 +35,7 @@ ANTHROPIC_API_KEY=your_anthropic_key_here
OPENAI_API_KEY=your_openai_key_here
```
3. Run the build script to set up all packages:
4. Run the build script to set up all packages:
```bash
./scripts/build.sh
```
@@ -41,9 +46,9 @@ This will:
- Set up the correct Python path
- Install development tools
4. Open the workspace in VSCode or Cursor:
5. Open the workspace in VSCode or Cursor:
```bash
# Using VSCode or Cursor
# For Cua Python development
code .vscode/py.code-workspace
# For Lume (Swift) development
@@ -56,9 +61,55 @@ Using the workspace file is strongly recommended as it:
- Enables debugging configurations
- Maintains consistent settings across packages
### Docker Development Environment
As an alternative to running directly on your host machine, you can use Docker for development. This approach has several advantages:
- Ensures consistent development environment across different machines
- Isolates dependencies from your host system
- Works well for cross-platform development
- Avoids conflicts with existing Python installations
#### Prerequisites
- Docker installed on your machine
- Lume server running on your host (port 3000): `lume serve`
#### Setup and Usage
1. Build the development Docker image:
```bash
./scripts/run-docker-dev.sh build
```
2. Run an example in the container:
```bash
./scripts/run-docker-dev.sh run computer_examples.py
```
3. Get an interactive shell in the container:
```bash
./scripts/run-docker-dev.sh run --interactive
```
4. Stop any running containers:
```bash
./scripts/run-docker-dev.sh stop
```
#### How it Works
The Docker development environment:
- Installs all required Python dependencies in the container
- Mounts your source code from the host at runtime
- Automatically configures the connection to use host.docker.internal:3000 for accessing the Lume server on your host machine
- Preserves your code changes without requiring rebuilds (source code is mounted as a volume)
> **Note**: The Docker container doesn't include the macOS-specific Lume executable. Instead, it connects to the Lume server running on your host machine via host.docker.internal:3000. Make sure to start the Lume server on your host before running examples in the container.
### Cleanup and Reset
If you need to clean up the environment and start fresh:
If you need to clean up the environment (non-docker) and start fresh:
```bash
./scripts/cleanup.sh