morphcloud


Namemorphcloud JSON
Version 0.1.83 PyPI version JSON
download
home_pageNone
SummaryA Python SDK and CLI tool for creating, managing, and interacting with Morph Cloud VMs.
upload_time2025-07-30 23:18:37
maintainerNone
docs_urlNone
authorNone
requires_python>=3.10
licenseApache-2.0
keywords cli cloud morph runtimes
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Morph Cloud Python SDK 

## Overview

[Morph Cloud](https://cloud.morph.so) is a powerful platform for creating, managing, and interacting with remote AI development environments called runtimes. It provides a comprehensive Python SDK and CLI to:

- Create and manage VM snapshots
- Start, stop, pause, and resume VM instances
- Execute commands via SSH
- Transfer files between local and remote environments
- Expose HTTP services with optional authentication
- Create Docker containers within instances
- Cache and reuse computational results with snapshot chains

### Documentation

For comprehensive documentation, visit the [Morph Cloud Documentation](https://cloud.morph.so/docs/documentation/overview)

### Getting Your API Key

1. Go to [https://cloud.morph.so/web/keys](https://cloud.morph.so/web/keys)
2. Log in with your credentials
3. Create a new API key

## Setup Guide

### Prerequisites

- Python 3.10 or higher
- An account on [Morph Cloud](https://cloud.morph.so)

### Environment Setup with `uv`

[`uv`](https://github.com/astral-sh/uv) is a fast, modern Python package installer and resolver that works great with Morph Cloud.

#### Installing `uv`

```bash
# On macOS and Linux
curl -LsSf https://astral.sh/uv/install.sh | sh

# On Windows
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
```

#### Setting Up a Project Environment

```bash
# Create a new project directory
mkdir my-morph-project
cd my-morph-project

# Create a virtual environment with uv
uv venv

# Activate the environment
# On macOS/Linux:
source .venv/bin/activate
# On Windows (cmd):
.venv\Scripts\activate
# On Windows (PowerShell):
.\.venv\Scripts\Activate.ps1

# Now you're ready to install packages like `morphcloud`
```

### Installation

```bash
# Using uv (recommended)
uv pip install morphcloud --upgrade

# Or using traditional pip
pip install morphcloud --upgrade
```

## Command Line Interface

The SDK includes a comprehensive command-line interface.

### Global Options

```bash
# Display version
morphcloud --version

# Get help
morphcloud --help
```

### Images

```bash
# List available images
morphcloud image list [--json]
```

### Snapshots

```bash
# List all snapshots
morphcloud snapshot list [--json] [--metadata KEY=VALUE]

# Create a new snapshot
morphcloud snapshot create --image-id <id> --vcpus <n> --memory <mb> --disk-size <mb> [--digest <hash>] [--metadata KEY=VALUE]

# Get detailed snapshot information
morphcloud snapshot get <snapshot-id>

# Delete a snapshot
morphcloud snapshot delete <snapshot-id>

# Set metadata on a snapshot
morphcloud snapshot set-metadata <snapshot-id> KEY1=VALUE1 [KEY2=VALUE2...]
```

### Instances

```bash
# List all instances
morphcloud instance list [--json] [--metadata KEY=VALUE]

# Start a new instance from snapshot
morphcloud instance start <snapshot-id> [--json] [--metadata KEY=VALUE] [--ttl-seconds <seconds>] [--ttl-action stop|pause]

# Pause an instance
morphcloud instance pause <instance-id>

# Resume a paused instance
morphcloud instance resume <instance-id>

# Stop an instance
morphcloud instance stop <instance-id>

# Get instance details
morphcloud instance get <instance-id>

# Create snapshot from instance
morphcloud instance snapshot <instance-id> [--digest <hash>] [--json]

# Create multiple instances from an instance (branching)
morphcloud instance branch <instance-id> [--count <n>] [--json]

# Set metadata on an instance
morphcloud instance set-metadata <instance-id> KEY1=VALUE1 [KEY2=VALUE2...]
```

### Instance Management

```bash
# Execute command on instance
morphcloud instance exec <instance-id> <command>

# SSH into instance
morphcloud instance ssh <instance-id> [--rm] [--snapshot] [command]

# Port forwarding
morphcloud instance port-forward <instance-id> <remote-port> [local-port]

# Expose HTTP service
morphcloud instance expose-http <instance-id> <name> <port> [--auth-mode none|api_key]

# Hide HTTP service
morphcloud instance hide-http <instance-id> <name>
```

### File Transfer

```bash
# Copy files to/from an instance
morphcloud instance copy <source> <destination> [--recursive]

# Examples:
# Local to remote
morphcloud instance copy ./local_file.txt inst_123:/remote/path/
# Remote to local
morphcloud instance copy inst_123:/remote/file.log ./local_dir/
# Copy directory recursively
morphcloud instance copy -r ./local_dir inst_123:/remote/dir
```

### Interactive Tools

```bash
# Start an interactive chat session with an instance
# Note: Requires ANTHROPIC_API_KEY environment variable
morphcloud instance chat <instance-id> [instructions]

# Start a computer MCP session with an instance
# Note: Requires "morphcloud[computer]" installation
morphcloud instance computer-mcp <instance-id>
```

### Development Installation

For developers who want to contribute to Morph Cloud:

```bash
# Clone the repository
git clone https://github.com/your-org/morphcloud.git
cd morphcloud

# Install in development mode with dev dependencies
uv pip install -e ".[dev]"

# To also include Computer SDK for development
uv pip install -e ".[dev,computer]"
```

### Configuration

Set your API key as an environment variable:

```bash
# On macOS/Linux
export MORPH_API_KEY="your-api-key"

# On Windows (PowerShell)
$env:MORPH_API_KEY="your-api-key"

# On Windows (cmd)
set MORPH_API_KEY=your-api-key
```

## Python API

### Basic Usage

```python
from morphcloud.api import MorphCloudClient

# Initialize the client
client = MorphCloudClient()

# List available base images
print("\n\nAvailable base images:")
images = client.images.list()
for image in images:
    print(f"  {image.id}:\t{image.name}")

# Create a snapshot from a base image
print("\nCreating snapshot from base image...", end="")
snapshot = client.snapshots.create(
    image_id="morphvm-minimal",
    vcpus=1,
    memory=512,
    disk_size=1024
)
print("done")

# Start an instance from the snapshot
print("Starting instance from snapshot.....", end="")
instance = client.instances.start(snapshot_id=snapshot.id)
print("done")


# Wait for the instance to be ready
print("Waiting until instance is ready.....", end="")
instance.wait_until_ready()
print("done")


# Stop the instance when done
print("Stopping the instance...............", end="")
instance.stop()
print("done\n")
```

### Working with SSH

```python
from morphcloud.api import MorphCloudClient

client = MorphCloudClient()
snapshot = client.snapshots.create(vcpus=1, memory=512, disk_size=1024, image_id="morphvm-minimal")

# Using context managers for automatic cleanup
with client.instances.start(snapshot_id=snapshot.id) as instance:
    instance.wait_until_ready()
    
    # Connect via SSH and run commands
    with instance.ssh() as ssh:
        # Run a basic command
        result = ssh.run("echo 'Hello from MorphCloud!'")
        print(result.stdout)
        
        # Install packages
        ssh.run("apt-get update && apt-get install -y python3-pip").raise_on_error()
        
        # Upload a local file to the instance
        ssh.copy_to("./local_script.py", "/home/user/remote_script.py")
        
        # Execute the uploaded script
        ssh.run("python3 /home/user/remote_script.py")
        
        # Download a file from the instance
        ssh.copy_from("/home/user/results.txt", "./local_results.txt")
```

### HTTP Services and Port Forwarding

```python
import time
import requests
from morphcloud.api import MorphCloudClient

client = MorphCloudClient()
snapshot = client.snapshots.get("your_snapshot_id")  # Use an existing snapshot

with client.instances.start(snapshot_id=snapshot.id) as instance:
    instance.wait_until_ready()
    
    with instance.ssh() as ssh:
        # Start a simple HTTP server on the instance
        ssh.run("python3 -m http.server 8080 &")
        
        # Method 1: Expose as HTTP service with public URL
        service_url = instance.expose_http_service("my-service", 8080)
        print(f"Service available at: {service_url}")
        
        # Method 2: Create an SSH tunnel for local port forwarding
        with ssh.tunnel(local_port=8888, remote_port=8080):
            time.sleep(1)  # Give the tunnel time to establish
            response = requests.get("http://localhost:8888")
            print(response.text)
```

### Advanced: Snapshot Chains and Caching

One of Morph Cloud's powerful features is the ability to create chains of snapshots with cached operations:

```python
from morphcloud.api import MorphCloudClient

client = MorphCloudClient()
base_snapshot = client.snapshots.get("your_base_snapshot_id")

# Each exec operation creates a new snapshot that includes the changes
# If you run the same command again, it will use the cached snapshot
python_snapshot = base_snapshot.exec("apt-get update && apt-get install -y python3 python3-pip")
numpy_snapshot = python_snapshot.exec("pip install numpy pandas matplotlib")

# Upload local files to a snapshot and create a new snapshot with those files
data_snapshot = numpy_snapshot.upload("./data/", "/home/user/data/", recursive=True)

# Run your analysis on the data
results_snapshot = data_snapshot.exec("python3 /home/user/data/analyze.py")

# Start an instance from the final snapshot with all changes applied
instance = client.instances.start(snapshot_id=results_snapshot.id)
```

### Docker Container Integration

Set up instances that automatically redirect to Docker containers:

```python
from morphcloud.api import MorphCloudClient

client = MorphCloudClient()
base_snapshot = client.snapshots.get("your_base_snapshot_id")

# Create a snapshot with a PostgreSQL container
postgres_snapshot = base_snapshot.as_container(
    image="postgres:13",
    container_name="postgres",
    env={"POSTGRES_PASSWORD": "example"},
    ports={5432: 5432}
)

# When you start an instance from this snapshot, all SSH sessions
# will automatically connect to the container instead of the host
with client.instances.start(snapshot_id=postgres_snapshot.id) as instance:
    instance.wait_until_ready()
    
    # This SSH session will connect directly to the container
    with instance.ssh() as ssh:
        ssh.run("psql -U postgres")
```

### Experimental: Computer SDK

The Computer SDK provides advanced browser automation and interactive capabilities for instances. Contact the [Morph team](mailto:jesse@morph.so) for preview access to the Morph Cloud Computer snapshot. This requires installing the `computer` extra:

```python
# First ensure you've installed: uv pip install "morphcloud[computer]"

from morphcloud.api import MorphCloudClient
from morphcloud.computer import Computer

# Initialize the client
client = MorphCloudClient()

# Use an existing instance
instance = client.instances.get("your_instance_id")

# Convert to a Computer instance
computer = Computer(instance)

# Use the browser automation
browser = computer.browser
browser.connect()
browser.goto("https://example.com")
screenshot = browser.screenshot()
browser.click(100, 200)
browser.type("Hello World")

# Clean up when done
browser.close()
```

### Asynchronous API

Morph Cloud also provides asynchronous versions of all methods:

```python
import asyncio
from morphcloud.api import MorphCloudClient

async def main():
    client = MorphCloudClient()
    
    # Async list images
    images = await client.images.alist()
    
    # Async create snapshot
    snapshot = await client.snapshots.acreate(
        image_id="morphvm-minimal", 
        vcpus=1, 
        memory=512, 
        disk_size=1024
    )
    
    # Async start instance
    instance = await client.instances.astart(snapshot_id=snapshot.id)
    
    # Async wait for ready
    await instance.await_until_ready()
    
    # Async stop instance
    await instance.astop()

asyncio.run(main())
```

## Advanced Features

### Environment Variables

- `MORPH_API_KEY`: Your Morph Cloud API key
- `MORPH_BASE_URL`: Override the default API URL (defaults to "https://cloud.morph.so/api")
- `MORPH_SSH_HOSTNAME`: Override the SSH hostname (defaults to "ssh.cloud.morph.so")
- `MORPH_SSH_PORT`: Override the SSH port (defaults to 22)

## Support

For issues, questions, or feature requests, please contact us at:
[contact@morph.so](mailto:contact@morph.so)

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "morphcloud",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": null,
    "keywords": "cli, cloud, morph, runtimes",
    "author": null,
    "author_email": "Morph Labs <jobs@morph.so>",
    "download_url": "https://files.pythonhosted.org/packages/98/d8/e96cc518ebff2fd6e08a8338a808ccb8a15f679d480a5af1f374d3b1be6c/morphcloud-0.1.83.tar.gz",
    "platform": null,
    "description": "# Morph Cloud Python SDK \n\n## Overview\n\n[Morph Cloud](https://cloud.morph.so) is a powerful platform for creating, managing, and interacting with remote AI development environments called runtimes. It provides a comprehensive Python SDK and CLI to:\n\n- Create and manage VM snapshots\n- Start, stop, pause, and resume VM instances\n- Execute commands via SSH\n- Transfer files between local and remote environments\n- Expose HTTP services with optional authentication\n- Create Docker containers within instances\n- Cache and reuse computational results with snapshot chains\n\n### Documentation\n\nFor comprehensive documentation, visit the [Morph Cloud Documentation](https://cloud.morph.so/docs/documentation/overview)\n\n### Getting Your API Key\n\n1. Go to [https://cloud.morph.so/web/keys](https://cloud.morph.so/web/keys)\n2. Log in with your credentials\n3. Create a new API key\n\n## Setup Guide\n\n### Prerequisites\n\n- Python 3.10 or higher\n- An account on [Morph Cloud](https://cloud.morph.so)\n\n### Environment Setup with `uv`\n\n[`uv`](https://github.com/astral-sh/uv) is a fast, modern Python package installer and resolver that works great with Morph Cloud.\n\n#### Installing `uv`\n\n```bash\n# On macOS and Linux\ncurl -LsSf https://astral.sh/uv/install.sh | sh\n\n# On Windows\npowershell -ExecutionPolicy ByPass -c \"irm https://astral.sh/uv/install.ps1 | iex\"\n```\n\n#### Setting Up a Project Environment\n\n```bash\n# Create a new project directory\nmkdir my-morph-project\ncd my-morph-project\n\n# Create a virtual environment with uv\nuv venv\n\n# Activate the environment\n# On macOS/Linux:\nsource .venv/bin/activate\n# On Windows (cmd):\n.venv\\Scripts\\activate\n# On Windows (PowerShell):\n.\\.venv\\Scripts\\Activate.ps1\n\n# Now you're ready to install packages like `morphcloud`\n```\n\n### Installation\n\n```bash\n# Using uv (recommended)\nuv pip install morphcloud --upgrade\n\n# Or using traditional pip\npip install morphcloud --upgrade\n```\n\n## Command Line Interface\n\nThe SDK includes a comprehensive command-line interface.\n\n### Global Options\n\n```bash\n# Display version\nmorphcloud --version\n\n# Get help\nmorphcloud --help\n```\n\n### Images\n\n```bash\n# List available images\nmorphcloud image list [--json]\n```\n\n### Snapshots\n\n```bash\n# List all snapshots\nmorphcloud snapshot list [--json] [--metadata KEY=VALUE]\n\n# Create a new snapshot\nmorphcloud snapshot create --image-id <id> --vcpus <n> --memory <mb> --disk-size <mb> [--digest <hash>] [--metadata KEY=VALUE]\n\n# Get detailed snapshot information\nmorphcloud snapshot get <snapshot-id>\n\n# Delete a snapshot\nmorphcloud snapshot delete <snapshot-id>\n\n# Set metadata on a snapshot\nmorphcloud snapshot set-metadata <snapshot-id> KEY1=VALUE1 [KEY2=VALUE2...]\n```\n\n### Instances\n\n```bash\n# List all instances\nmorphcloud instance list [--json] [--metadata KEY=VALUE]\n\n# Start a new instance from snapshot\nmorphcloud instance start <snapshot-id> [--json] [--metadata KEY=VALUE] [--ttl-seconds <seconds>] [--ttl-action stop|pause]\n\n# Pause an instance\nmorphcloud instance pause <instance-id>\n\n# Resume a paused instance\nmorphcloud instance resume <instance-id>\n\n# Stop an instance\nmorphcloud instance stop <instance-id>\n\n# Get instance details\nmorphcloud instance get <instance-id>\n\n# Create snapshot from instance\nmorphcloud instance snapshot <instance-id> [--digest <hash>] [--json]\n\n# Create multiple instances from an instance (branching)\nmorphcloud instance branch <instance-id> [--count <n>] [--json]\n\n# Set metadata on an instance\nmorphcloud instance set-metadata <instance-id> KEY1=VALUE1 [KEY2=VALUE2...]\n```\n\n### Instance Management\n\n```bash\n# Execute command on instance\nmorphcloud instance exec <instance-id> <command>\n\n# SSH into instance\nmorphcloud instance ssh <instance-id> [--rm] [--snapshot] [command]\n\n# Port forwarding\nmorphcloud instance port-forward <instance-id> <remote-port> [local-port]\n\n# Expose HTTP service\nmorphcloud instance expose-http <instance-id> <name> <port> [--auth-mode none|api_key]\n\n# Hide HTTP service\nmorphcloud instance hide-http <instance-id> <name>\n```\n\n### File Transfer\n\n```bash\n# Copy files to/from an instance\nmorphcloud instance copy <source> <destination> [--recursive]\n\n# Examples:\n# Local to remote\nmorphcloud instance copy ./local_file.txt inst_123:/remote/path/\n# Remote to local\nmorphcloud instance copy inst_123:/remote/file.log ./local_dir/\n# Copy directory recursively\nmorphcloud instance copy -r ./local_dir inst_123:/remote/dir\n```\n\n### Interactive Tools\n\n```bash\n# Start an interactive chat session with an instance\n# Note: Requires ANTHROPIC_API_KEY environment variable\nmorphcloud instance chat <instance-id> [instructions]\n\n# Start a computer MCP session with an instance\n# Note: Requires \"morphcloud[computer]\" installation\nmorphcloud instance computer-mcp <instance-id>\n```\n\n### Development Installation\n\nFor developers who want to contribute to Morph Cloud:\n\n```bash\n# Clone the repository\ngit clone https://github.com/your-org/morphcloud.git\ncd morphcloud\n\n# Install in development mode with dev dependencies\nuv pip install -e \".[dev]\"\n\n# To also include Computer SDK for development\nuv pip install -e \".[dev,computer]\"\n```\n\n### Configuration\n\nSet your API key as an environment variable:\n\n```bash\n# On macOS/Linux\nexport MORPH_API_KEY=\"your-api-key\"\n\n# On Windows (PowerShell)\n$env:MORPH_API_KEY=\"your-api-key\"\n\n# On Windows (cmd)\nset MORPH_API_KEY=your-api-key\n```\n\n## Python API\n\n### Basic Usage\n\n```python\nfrom morphcloud.api import MorphCloudClient\n\n# Initialize the client\nclient = MorphCloudClient()\n\n# List available base images\nprint(\"\\n\\nAvailable base images:\")\nimages = client.images.list()\nfor image in images:\n    print(f\"  {image.id}:\\t{image.name}\")\n\n# Create a snapshot from a base image\nprint(\"\\nCreating snapshot from base image...\", end=\"\")\nsnapshot = client.snapshots.create(\n    image_id=\"morphvm-minimal\",\n    vcpus=1,\n    memory=512,\n    disk_size=1024\n)\nprint(\"done\")\n\n# Start an instance from the snapshot\nprint(\"Starting instance from snapshot.....\", end=\"\")\ninstance = client.instances.start(snapshot_id=snapshot.id)\nprint(\"done\")\n\n\n# Wait for the instance to be ready\nprint(\"Waiting until instance is ready.....\", end=\"\")\ninstance.wait_until_ready()\nprint(\"done\")\n\n\n# Stop the instance when done\nprint(\"Stopping the instance...............\", end=\"\")\ninstance.stop()\nprint(\"done\\n\")\n```\n\n### Working with SSH\n\n```python\nfrom morphcloud.api import MorphCloudClient\n\nclient = MorphCloudClient()\nsnapshot = client.snapshots.create(vcpus=1, memory=512, disk_size=1024, image_id=\"morphvm-minimal\")\n\n# Using context managers for automatic cleanup\nwith client.instances.start(snapshot_id=snapshot.id) as instance:\n    instance.wait_until_ready()\n    \n    # Connect via SSH and run commands\n    with instance.ssh() as ssh:\n        # Run a basic command\n        result = ssh.run(\"echo 'Hello from MorphCloud!'\")\n        print(result.stdout)\n        \n        # Install packages\n        ssh.run(\"apt-get update && apt-get install -y python3-pip\").raise_on_error()\n        \n        # Upload a local file to the instance\n        ssh.copy_to(\"./local_script.py\", \"/home/user/remote_script.py\")\n        \n        # Execute the uploaded script\n        ssh.run(\"python3 /home/user/remote_script.py\")\n        \n        # Download a file from the instance\n        ssh.copy_from(\"/home/user/results.txt\", \"./local_results.txt\")\n```\n\n### HTTP Services and Port Forwarding\n\n```python\nimport time\nimport requests\nfrom morphcloud.api import MorphCloudClient\n\nclient = MorphCloudClient()\nsnapshot = client.snapshots.get(\"your_snapshot_id\")  # Use an existing snapshot\n\nwith client.instances.start(snapshot_id=snapshot.id) as instance:\n    instance.wait_until_ready()\n    \n    with instance.ssh() as ssh:\n        # Start a simple HTTP server on the instance\n        ssh.run(\"python3 -m http.server 8080 &\")\n        \n        # Method 1: Expose as HTTP service with public URL\n        service_url = instance.expose_http_service(\"my-service\", 8080)\n        print(f\"Service available at: {service_url}\")\n        \n        # Method 2: Create an SSH tunnel for local port forwarding\n        with ssh.tunnel(local_port=8888, remote_port=8080):\n            time.sleep(1)  # Give the tunnel time to establish\n            response = requests.get(\"http://localhost:8888\")\n            print(response.text)\n```\n\n### Advanced: Snapshot Chains and Caching\n\nOne of Morph Cloud's powerful features is the ability to create chains of snapshots with cached operations:\n\n```python\nfrom morphcloud.api import MorphCloudClient\n\nclient = MorphCloudClient()\nbase_snapshot = client.snapshots.get(\"your_base_snapshot_id\")\n\n# Each exec operation creates a new snapshot that includes the changes\n# If you run the same command again, it will use the cached snapshot\npython_snapshot = base_snapshot.exec(\"apt-get update && apt-get install -y python3 python3-pip\")\nnumpy_snapshot = python_snapshot.exec(\"pip install numpy pandas matplotlib\")\n\n# Upload local files to a snapshot and create a new snapshot with those files\ndata_snapshot = numpy_snapshot.upload(\"./data/\", \"/home/user/data/\", recursive=True)\n\n# Run your analysis on the data\nresults_snapshot = data_snapshot.exec(\"python3 /home/user/data/analyze.py\")\n\n# Start an instance from the final snapshot with all changes applied\ninstance = client.instances.start(snapshot_id=results_snapshot.id)\n```\n\n### Docker Container Integration\n\nSet up instances that automatically redirect to Docker containers:\n\n```python\nfrom morphcloud.api import MorphCloudClient\n\nclient = MorphCloudClient()\nbase_snapshot = client.snapshots.get(\"your_base_snapshot_id\")\n\n# Create a snapshot with a PostgreSQL container\npostgres_snapshot = base_snapshot.as_container(\n    image=\"postgres:13\",\n    container_name=\"postgres\",\n    env={\"POSTGRES_PASSWORD\": \"example\"},\n    ports={5432: 5432}\n)\n\n# When you start an instance from this snapshot, all SSH sessions\n# will automatically connect to the container instead of the host\nwith client.instances.start(snapshot_id=postgres_snapshot.id) as instance:\n    instance.wait_until_ready()\n    \n    # This SSH session will connect directly to the container\n    with instance.ssh() as ssh:\n        ssh.run(\"psql -U postgres\")\n```\n\n### Experimental: Computer SDK\n\nThe Computer SDK provides advanced browser automation and interactive capabilities for instances. Contact the [Morph team](mailto:jesse@morph.so) for preview access to the Morph Cloud Computer snapshot. This requires installing the `computer` extra:\n\n```python\n# First ensure you've installed: uv pip install \"morphcloud[computer]\"\n\nfrom morphcloud.api import MorphCloudClient\nfrom morphcloud.computer import Computer\n\n# Initialize the client\nclient = MorphCloudClient()\n\n# Use an existing instance\ninstance = client.instances.get(\"your_instance_id\")\n\n# Convert to a Computer instance\ncomputer = Computer(instance)\n\n# Use the browser automation\nbrowser = computer.browser\nbrowser.connect()\nbrowser.goto(\"https://example.com\")\nscreenshot = browser.screenshot()\nbrowser.click(100, 200)\nbrowser.type(\"Hello World\")\n\n# Clean up when done\nbrowser.close()\n```\n\n### Asynchronous API\n\nMorph Cloud also provides asynchronous versions of all methods:\n\n```python\nimport asyncio\nfrom morphcloud.api import MorphCloudClient\n\nasync def main():\n    client = MorphCloudClient()\n    \n    # Async list images\n    images = await client.images.alist()\n    \n    # Async create snapshot\n    snapshot = await client.snapshots.acreate(\n        image_id=\"morphvm-minimal\", \n        vcpus=1, \n        memory=512, \n        disk_size=1024\n    )\n    \n    # Async start instance\n    instance = await client.instances.astart(snapshot_id=snapshot.id)\n    \n    # Async wait for ready\n    await instance.await_until_ready()\n    \n    # Async stop instance\n    await instance.astop()\n\nasyncio.run(main())\n```\n\n## Advanced Features\n\n### Environment Variables\n\n- `MORPH_API_KEY`: Your Morph Cloud API key\n- `MORPH_BASE_URL`: Override the default API URL (defaults to \"https://cloud.morph.so/api\")\n- `MORPH_SSH_HOSTNAME`: Override the SSH hostname (defaults to \"ssh.cloud.morph.so\")\n- `MORPH_SSH_PORT`: Override the SSH port (defaults to 22)\n\n## Support\n\nFor issues, questions, or feature requests, please contact us at:\n[contact@morph.so](mailto:contact@morph.so)\n",
    "bugtrack_url": null,
    "license": "Apache-2.0",
    "summary": "A Python SDK and CLI tool for creating, managing, and interacting with Morph Cloud VMs.",
    "version": "0.1.83",
    "project_urls": null,
    "split_keywords": [
        "cli",
        " cloud",
        " morph",
        " runtimes"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "3a6a9a6559b995f1e5d733534b7b177870dc3e1ca8026fe6a8269f8ca50b0028",
                "md5": "56ae62c1d46db44b250311c7c51a2d55",
                "sha256": "5e0af2e55bee5a534812ff1b204733ec9d52735816dcf0d335b36d1c70dea8f7"
            },
            "downloads": -1,
            "filename": "morphcloud-0.1.83-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "56ae62c1d46db44b250311c7c51a2d55",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 103926,
            "upload_time": "2025-07-30T23:18:35",
            "upload_time_iso_8601": "2025-07-30T23:18:35.871116Z",
            "url": "https://files.pythonhosted.org/packages/3a/6a/9a6559b995f1e5d733534b7b177870dc3e1ca8026fe6a8269f8ca50b0028/morphcloud-0.1.83-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "98d8e96cc518ebff2fd6e08a8338a808ccb8a15f679d480a5af1f374d3b1be6c",
                "md5": "ee8f02796a9ec024331a0ecee80add22",
                "sha256": "0ebae273d2da99a33aa5794114f2f50925efa176d0681cfbac1529c56d0b88b2"
            },
            "downloads": -1,
            "filename": "morphcloud-0.1.83.tar.gz",
            "has_sig": false,
            "md5_digest": "ee8f02796a9ec024331a0ecee80add22",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 190406,
            "upload_time": "2025-07-30T23:18:37",
            "upload_time_iso_8601": "2025-07-30T23:18:37.186138Z",
            "url": "https://files.pythonhosted.org/packages/98/d8/e96cc518ebff2fd6e08a8338a808ccb8a15f679d480a5af1f374d3b1be6c/morphcloud-0.1.83.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-30 23:18:37",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "morphcloud"
}
        
Elapsed time: 1.75653s