mirror of
https://github.com/trycua/computer.git
synced 2026-05-14 20:39:03 -05:00
chore: fix pdm installation
- This commit follows the PDM best practices for [managing a monorepo](https://pdm-project.org/en/latest/usage/advanced/#use-pdm-to-manage-a-monorepo) Refs: #131
This commit is contained in:
+37
-1
@@ -3,6 +3,7 @@
|
||||
### Project Structure
|
||||
|
||||
The project is organized as a monorepo with these main packages:
|
||||
|
||||
- `libs/core/` - Base package with telemetry support
|
||||
- `libs/computer/` - Computer-use interface (CUI) library
|
||||
- `libs/agent/` - AI agent library with multi-provider support
|
||||
@@ -16,17 +17,20 @@ Each package has its own virtual environment and dependencies, managed through P
|
||||
### Local Development Setup
|
||||
|
||||
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
|
||||
```
|
||||
|
||||
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
|
||||
@@ -36,6 +40,7 @@ OPENAI_API_KEY=your_openai_key_here
|
||||
```
|
||||
|
||||
4. Open the workspace in VSCode or Cursor:
|
||||
|
||||
```bash
|
||||
# For Cua Python development
|
||||
code .vscode/py.code-workspace
|
||||
@@ -45,6 +50,7 @@ code .vscode/lume.code-workspace
|
||||
```
|
||||
|
||||
Using the workspace file is strongly recommended as it:
|
||||
|
||||
- Sets up correct Python environments for each package
|
||||
- Configures proper import paths
|
||||
- Enables debugging configurations
|
||||
@@ -56,7 +62,12 @@ Refer to the [Lume README](../libs/lume/docs/Development.md) for instructions on
|
||||
|
||||
### Python Development
|
||||
|
||||
There are two ways to instal Lume:
|
||||
|
||||
#### Run the build script
|
||||
|
||||
Run the build script to set up all packages:
|
||||
|
||||
```bash
|
||||
./scripts/build.sh
|
||||
```
|
||||
@@ -64,11 +75,28 @@ Run the build script to set up all packages:
|
||||
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:
|
||||
|
||||
- Create a virtual environment for the project
|
||||
- Install all packages in development mode
|
||||
- Set up the correct Python path
|
||||
- Install development tools
|
||||
|
||||
#### Install with PDM
|
||||
|
||||
If PDM is not already installed, you can follow the installation instructions [here](https://pdm-project.org/en/latest/#installation).
|
||||
|
||||
To install with PDM, simply run:
|
||||
|
||||
```console
|
||||
pdm install -G:all
|
||||
```
|
||||
|
||||
This installs all the dependencies for development, testing, and building the docs. If you'd oly like development dependencies, you can run:
|
||||
|
||||
```console
|
||||
pdm install -d
|
||||
```
|
||||
|
||||
### Running Examples
|
||||
|
||||
The Python workspace includes launch configurations for all packages:
|
||||
@@ -79,10 +107,12 @@ The Python workspace includes launch configurations for all packages:
|
||||
- "SOM" configurations - Various settings for running SOM
|
||||
|
||||
To run examples from VSCode / Cursor:
|
||||
|
||||
1. Press F5 or use the Run/Debug view
|
||||
2. Select the desired configuration
|
||||
|
||||
The workspace also includes compound launch configurations:
|
||||
|
||||
- "Run Computer Examples + Server" - Runs both the Computer Examples and Server simultaneously
|
||||
|
||||
### Docker Development Environment
|
||||
@@ -97,21 +127,25 @@ As an alternative to installing directly on your host machine, you can use Docke
|
||||
#### 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
|
||||
```
|
||||
@@ -119,6 +153,7 @@ As an alternative to installing directly on your host machine, you can use Docke
|
||||
#### 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
|
||||
@@ -135,6 +170,7 @@ If you need to clean up the environment (non-docker) and start fresh:
|
||||
```
|
||||
|
||||
This will:
|
||||
|
||||
- Remove all virtual environments
|
||||
- Clean Python cache files and directories
|
||||
- Remove build artifacts
|
||||
@@ -210,6 +246,7 @@ Python-specific settings in the workspace files:
|
||||
```
|
||||
|
||||
Recommended VS Code extensions:
|
||||
|
||||
- Black Formatter (ms-python.black-formatter)
|
||||
- Ruff (charliermarsh.ruff)
|
||||
- Pylance (ms-python.vscode-pylance)
|
||||
@@ -247,4 +284,3 @@ For Swift code in the `libs/lume` directory:
|
||||
- Follow the [Swift API Design Guidelines](https://www.swift.org/documentation/api-design-guidelines/)
|
||||
- Use SwiftFormat for consistent formatting
|
||||
- Code will be automatically formatted on save when using the lume workspace
|
||||
|
||||
|
||||
@@ -4,45 +4,38 @@ PyLume Python SDK - A client library for managing macOS VMs with PyLume.
|
||||
Example:
|
||||
>>> from pylume import PyLume, VMConfig
|
||||
>>> client = PyLume()
|
||||
>>> config = VMConfig(
|
||||
... name="my-vm",
|
||||
... cpu=4,
|
||||
... memory="8GB",
|
||||
... disk_size="64GB"
|
||||
... )
|
||||
>>> config = VMConfig(name="my-vm", cpu=4, memory="8GB", disk_size="64GB")
|
||||
>>> client.create_vm(config)
|
||||
>>> client.run_vm("my-vm")
|
||||
"""
|
||||
|
||||
# Import all models first
|
||||
from .models import (
|
||||
VMConfig,
|
||||
VMStatus,
|
||||
VMRunOpts,
|
||||
VMUpdateOpts,
|
||||
ImageRef,
|
||||
CloneSpec,
|
||||
SharedDirectory,
|
||||
ImageList,
|
||||
ImageInfo,
|
||||
)
|
||||
|
||||
# Import exceptions
|
||||
# Import exceptions then all models
|
||||
from .exceptions import (
|
||||
LumeError,
|
||||
LumeServerError,
|
||||
LumeConnectionError,
|
||||
LumeTimeoutError,
|
||||
LumeNotFoundError,
|
||||
LumeConfigError,
|
||||
LumeVMError,
|
||||
LumeConnectionError,
|
||||
LumeError,
|
||||
LumeImageError,
|
||||
LumeNotFoundError,
|
||||
LumeServerError,
|
||||
LumeTimeoutError,
|
||||
LumeVMError,
|
||||
)
|
||||
from .models import (
|
||||
CloneSpec,
|
||||
ImageInfo,
|
||||
ImageList,
|
||||
ImageRef,
|
||||
SharedDirectory,
|
||||
VMConfig,
|
||||
VMRunOpts,
|
||||
VMStatus,
|
||||
VMUpdateOpts,
|
||||
)
|
||||
|
||||
# Import main class last to avoid circular imports
|
||||
from .pylume import PyLume
|
||||
|
||||
__version__ = "0.1.0"
|
||||
__version__ = "0.1.8"
|
||||
|
||||
__all__ = [
|
||||
"PyLume",
|
||||
|
||||
+27
-31
@@ -1,21 +1,9 @@
|
||||
[build-system]
|
||||
requires = ["pdm-backend"]
|
||||
build-backend = "pdm.backend"
|
||||
requires = ["pdm-backend"]
|
||||
|
||||
[project]
|
||||
name = "pylume"
|
||||
version = "0.1.0"
|
||||
description = "Python SDK for lume - run macOS and Linux VMs on Apple Silicon"
|
||||
authors = [
|
||||
{ name = "TryCua", email = "gh@trycua.com" }
|
||||
]
|
||||
dependencies = [
|
||||
"pydantic>=2.11.1"
|
||||
]
|
||||
requires-python = ">=3.9"
|
||||
readme = "README.md"
|
||||
license = { text = "MIT" }
|
||||
keywords = ["macos", "virtualization", "vm", "apple-silicon"]
|
||||
authors = [{ name = "TryCua", email = "gh@trycua.com" }]
|
||||
classifiers = [
|
||||
"Intended Audience :: Developers",
|
||||
"License :: OSI Approved :: MIT License",
|
||||
@@ -25,6 +13,18 @@ classifiers = [
|
||||
"Programming Language :: Python :: 3.11",
|
||||
"Programming Language :: Python :: 3.12",
|
||||
]
|
||||
dependencies = ["pydantic>=2.11.1"]
|
||||
description = "Python SDK for lume - run macOS and Linux VMs on Apple Silicon"
|
||||
dynamic = ["version"]
|
||||
keywords = ["apple-silicon", "macos", "virtualization", "vm"]
|
||||
license = { text = "MIT" }
|
||||
name = "pylume"
|
||||
readme = "README.md"
|
||||
requires-python = ">=3.9"
|
||||
|
||||
[tool.pdm.version]
|
||||
path = "pylume/__init__.py"
|
||||
source = "file"
|
||||
|
||||
[project.urls]
|
||||
homepage = "https://github.com/trycua/pylume"
|
||||
@@ -32,17 +32,13 @@ repository = "https://github.com/trycua/pylume"
|
||||
|
||||
[tool.pdm]
|
||||
distribution = true
|
||||
package-dir = "."
|
||||
includes = [
|
||||
"pylume/lume"
|
||||
]
|
||||
|
||||
[tool.pdm.dev-dependencies]
|
||||
dev = [
|
||||
"pytest>=7.0.0",
|
||||
"pytest-asyncio>=0.23.0",
|
||||
"black>=23.0.0",
|
||||
"isort>=5.12.0"
|
||||
"isort>=5.12.0",
|
||||
"pytest-asyncio>=0.23.0",
|
||||
"pytest>=7.0.0",
|
||||
]
|
||||
|
||||
[tool.black]
|
||||
@@ -50,29 +46,29 @@ line-length = 100
|
||||
target-version = ["py310"]
|
||||
|
||||
[tool.ruff]
|
||||
line-length = 100
|
||||
target-version = "py310"
|
||||
select = ["E", "F", "B", "I"]
|
||||
fix = true
|
||||
line-length = 100
|
||||
select = ["B", "E", "F", "I"]
|
||||
target-version = "py310"
|
||||
|
||||
[tool.ruff.format]
|
||||
docstring-code-format = true
|
||||
|
||||
[tool.mypy]
|
||||
strict = true
|
||||
python_version = "3.10"
|
||||
ignore_missing_imports = true
|
||||
disallow_untyped_defs = true
|
||||
check_untyped_defs = true
|
||||
warn_return_any = true
|
||||
disallow_untyped_defs = true
|
||||
ignore_missing_imports = true
|
||||
python_version = "3.10"
|
||||
show_error_codes = true
|
||||
strict = true
|
||||
warn_return_any = true
|
||||
warn_unused_ignores = false
|
||||
|
||||
[tool.pytest.ini_options]
|
||||
asyncio_mode = "auto"
|
||||
testpaths = ["tests"]
|
||||
python_files = "test_*.py"
|
||||
testpaths = ["tests"]
|
||||
|
||||
[tool.pdm.build]
|
||||
includes = ["pylume/"]
|
||||
source-includes = ["tests/", "README.md", "LICENSE"]
|
||||
source-includes = ["LICENSE", "README.md", "tests/"]
|
||||
|
||||
+29
-37
@@ -1,18 +1,16 @@
|
||||
[build-system]
|
||||
requires = ["pdm-backend"]
|
||||
build-backend = "pdm.backend"
|
||||
requires = ["pdm-backend"]
|
||||
|
||||
[project]
|
||||
name = "cua-workspace"
|
||||
version = "0.1.0"
|
||||
description = "CUA (Computer Use Agent) mono-repo"
|
||||
authors = [
|
||||
{ name = "TryCua", email = "gh@trycua.com" }
|
||||
]
|
||||
authors = [{ name = "TryCua", email = "gh@trycua.com" }]
|
||||
dependencies = []
|
||||
requires-python = ">=3.10"
|
||||
readme = "README.md"
|
||||
description = "CUA (Computer Use Agent) mono-repo"
|
||||
license = { text = "MIT" }
|
||||
name = "cua-workspace"
|
||||
readme = "README.md"
|
||||
requires-python = ">=3.10"
|
||||
version = "0.1.0"
|
||||
|
||||
[project.urls]
|
||||
repository = "https://github.com/trycua/cua"
|
||||
@@ -26,63 +24,57 @@ distribution = false
|
||||
|
||||
[tool.pdm.dev-dependencies]
|
||||
dev = [
|
||||
"-e agent @ file:///${PROJECT_ROOT}/libs/agent",
|
||||
"-e computer @ file:///${PROJECT_ROOT}/libs/computer",
|
||||
"-e computer-server @ file:///${PROJECT_ROOT}/libs/computer-server",
|
||||
"-e cua-som @ file:///${PROJECT_ROOT}/libs/som",
|
||||
"-e mcp-server @ file:///${PROJECT_ROOT}/libs/mcp-server",
|
||||
"-e pylume @ file:///${PROJECT_ROOT}/libs/pylume",
|
||||
"black>=23.0.0",
|
||||
"ruff>=0.9.2",
|
||||
"mypy>=1.10.0",
|
||||
"types-requests>=2.31.0",
|
||||
"ipykernel>=6.29.5",
|
||||
"jedi>=0.19.2",
|
||||
"jupyter>=1.0.0",
|
||||
"jedi>=0.19.2"
|
||||
"mypy>=1.10.0",
|
||||
"ruff>=0.9.2",
|
||||
"types-requests>=2.31.0",
|
||||
]
|
||||
docs = ["mkdocs-material>=9.2.0", "mkdocs>=1.5.0"]
|
||||
test = [
|
||||
"pytest>=8.0.0",
|
||||
"aioresponses>=0.7.4",
|
||||
"pytest-asyncio>=0.21.1",
|
||||
"pytest-cov>=4.1.0",
|
||||
"pytest-mock>=3.10.0",
|
||||
"pytest-xdist>=3.6.1",
|
||||
"aioresponses>=0.7.4"
|
||||
]
|
||||
docs = [
|
||||
"mkdocs>=1.5.0",
|
||||
"mkdocs-material>=9.2.0"
|
||||
"pytest>=8.0.0",
|
||||
]
|
||||
|
||||
[tool.pdm.resolution]
|
||||
respect-source-order = true
|
||||
|
||||
[tool.pdm.resolution.overrides]
|
||||
cua-computer = {path = "libs/computer"}
|
||||
cua-som = {path = "libs/som"}
|
||||
cua-agent = {path = "libs/agent"}
|
||||
pylume = {path = "libs/pylume"}
|
||||
cua-computer-server = {path = "libs/computer-server"}
|
||||
cua-mcp-server = {path = "libs/mcp-server"}
|
||||
cua-core = {path = "libs/core"}
|
||||
|
||||
[tool.black]
|
||||
line-length = 100
|
||||
target-version = ["py310"]
|
||||
|
||||
[tool.ruff]
|
||||
line-length = 100
|
||||
target-version = "py310"
|
||||
select = ["E", "F", "B", "I"]
|
||||
fix = true
|
||||
line-length = 100
|
||||
select = ["B", "E", "F", "I"]
|
||||
target-version = "py310"
|
||||
|
||||
[tool.ruff.format]
|
||||
docstring-code-format = true
|
||||
|
||||
[tool.mypy]
|
||||
strict = true
|
||||
python_version = "3.10"
|
||||
ignore_missing_imports = true
|
||||
disallow_untyped_defs = true
|
||||
check_untyped_defs = true
|
||||
warn_return_any = true
|
||||
disallow_untyped_defs = true
|
||||
ignore_missing_imports = true
|
||||
python_version = "3.10"
|
||||
show_error_codes = true
|
||||
strict = true
|
||||
warn_return_any = true
|
||||
warn_unused_ignores = false
|
||||
|
||||
[tool.pytest.ini_options]
|
||||
asyncio_mode = "auto"
|
||||
python_files = "test_*.py"
|
||||
testpaths = ["libs/*/tests"]
|
||||
python_files = "test_*.py"
|
||||
Reference in New Issue
Block a user