Skip to main content

The Python SDK for Cudo Compute distributed compute platform.

Project description

Cudo Compute SDK

A Python SDK for the Cudo Compute Platform API.

Python PyPI License: Apache 2.0

GitHub Issues Pull Requests GitHub Contributors


๐Ÿš€ Quick Start

A Python SDK for interacting with the Cudo Compute REST API. Manage virtual machines, storage, networks, and other cloud resources programmatically.

Features

  • ๐Ÿš€ Async/Await Support - Built on httpx for efficient async operations
  • ๐Ÿ”’ Type Safe - Comprehensive type hints with Pydantic models
  • ๐Ÿ“ฆ Full API Coverage - Complete support for VMs, storage, networking, and more
  • ๐Ÿงช Well Tested - 112 tests with 78% code coverage
  • ๐Ÿ“š Great Documentation - Detailed docs with examples

Installation

Using pip

pip install cudo-compute-sdk

Using uv (recommended)

uv add cudo-compute-sdk

Quick Start

Basic Usage

import asyncio
from cudo_compute_sdk import CudoComputeSDK

async def main():
    # Initialize the SDK with your API key
    sdk = CudoComputeSDK(api_key="your-api-key-here")
    
    try:
        # List all projects
        projects = await sdk.list_projects()
        print(f"Found {len(projects)} projects")
        
        # List VMs in a project
        vms = await sdk.list_vms(project_id="my-project")
        for vm in vms:
            print(f"VM: {vm.id} - State: {vm.state}")
    
    finally:
        # Clean up
        await sdk.close()

asyncio.run(main())

Creating a Virtual Machine

async def create_vm_example():
    sdk = CudoComputeSDK(api_key="your-api-key")
    
    try:
        vm = await sdk.create_vm(
            project_id="my-project",
            vm_id="my-vm-001",
            data_center_id="gb-bournemouth-1",
            machine_type="standard",
            boot_disk_image_id="ubuntu-2204-lts",
            vcpus=2,
            memory_gib=4,
            gpus=0,
            ssh_key_source="SSH_KEY_SOURCE_USER"
        )
        print(f"Created VM: {vm.id}")
        print(f"IP Address: {vm.external_ip_address}")
    
    finally:
        await sdk.close()

Managing Storage

async def storage_example():
    sdk = CudoComputeSDK(api_key="your-api-key")
    
    try:
        # Create a disk
        disk = await sdk.create_disk(
            project_id="my-project",
            disk_id="data-disk-001",
            data_center_id="gb-bournemouth-1",
            size_gib=100
        )
        
        # Attach to VM
        await sdk.attach_disk(
            project_id="my-project",
            disk_id="data-disk-001",
            vm_id="my-vm-001"
        )
        
        print(f"Created and attached disk: {disk.id}")
    
    finally:
        await sdk.close()

API Key Setup

  1. Log in to Cudo Compute
  2. Navigate to your account settings
  3. Generate an API key
  4. Set it as an environment variable:
export CUDO_API_KEY="your-api-key-here"

Then use it in your code:

import os
from cudo_compute_sdk import CudoComputeSDK

sdk = CudoComputeSDK(api_key=os.getenv("CUDO_API_KEY"))

Documentation

Visit the full project documentation: Cudo Compute SDK Docs

Key Sections

Supported Operations

Virtual Machines

  • Create, start, stop, reboot, terminate VMs
  • Resize VMs (CPU, memory)
  • List and get VM details
  • Connect via web console
  • Monitor VM metrics

Data Centers & Machine Types

  • List available data centers
  • Get machine type specifications
  • Query pricing information

Storage

  • Create and manage disks
  • Attach/detach disks to VMs
  • Create and manage NFS volumes
  • Manage VM images (public and private)

Networking

  • Create and manage virtual networks
  • Configure security groups and rules
  • Manage SSH keys

Projects & Billing

  • List and manage projects
  • View billing account information

Development

Setup Development Environment

# Clone the repository
git clone https://github.com/vantagecompute/cudo-compute-sdk.git
cd cudo-compute-sdk

# Install dependencies
uv sync --extra dev

# Run tests
just unit

# Run type checking
just typecheck

# Format code
just fmt

# Run linter
just lint

Running Tests

# Run all unit tests with coverage
just unit

# Run tests with verbose output
uv run pytest tests/unit -v

# Run specific test file
uv run pytest tests/unit/test_sdk.py -v

Project Structure

cudo-compute-sdk/
โ”œโ”€โ”€ cudo_compute_sdk/
โ”‚   โ”œโ”€โ”€ __init__.py          # Main SDK implementation
โ”‚   โ””โ”€โ”€ schema.py            # Pydantic models for API data
โ”œโ”€โ”€ tests/
โ”‚   โ””โ”€โ”€ unit/
โ”‚       โ”œโ”€โ”€ test_sdk.py      # SDK method tests
โ”‚       โ””โ”€โ”€ test_schema.py   # Schema model tests
โ”œโ”€โ”€ docusaurus/              # Documentation site
โ”œโ”€โ”€ justfile                 # Development task runner
โ”œโ”€โ”€ pyproject.toml           # Project configuration
โ””โ”€โ”€ README.md

Contributing

We welcome contributions! Here's how to get started:

  1. Fork the repository

    git clone https://github.com/your-username/cudo-compute-sdk.git
    
  2. Create a feature branch

    git checkout -b feature/your-feature-name
    
  3. Make your changes

    • Write tests for new functionality
    • Ensure all tests pass: just unit
    • Run type checking: just typecheck
    • Format code: just fmt
  4. Commit your changes

    git commit -m "feat: add your feature description"
    
  5. Push and create a Pull Request

    git push origin feature/your-feature-name
    

Coding Standards

  • Python 3.12+ required
  • Type hints on all public methods
  • Docstrings for all public methods (Google style)
  • Tests for all new functionality
  • 80%+ test coverage for new code

Development Commands

just unit          # Run unit tests with coverage
just typecheck     # Run static type checking
just fmt           # Format code with ruff
just lint          # Run linters (codespell + ruff)
just docs-dev      # Start documentation dev server
just docs-build    # Build documentation

Requirements

  • Python 3.12 or higher
  • Dependencies:
    • httpx >= 0.28.1 (async HTTP client)
    • pydantic >= 2.0.0 (data validation)

License

This project is licensed under the Apache License 2.0.

See the LICENSE file for details.

Key Points

  • โœ… Free to use, modify, and distribute
  • โœ… Commercial use permitted
  • โœ… Patent rights granted
  • โœ… Must include license and copyright notice
  • โœ… Changes must be documented

Support

Acknowledgments

Built with:

Copyright

Copyright 2025 Vantage Compute Corporation

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.


Made with โค๏ธ by Vantage Compute

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cudo_compute_sdk-0.0.1.tar.gz (43.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cudo_compute_sdk-0.0.1-py3-none-any.whl (21.2 kB view details)

Uploaded Python 3

File details

Details for the file cudo_compute_sdk-0.0.1.tar.gz.

File metadata

  • Download URL: cudo_compute_sdk-0.0.1.tar.gz
  • Upload date:
  • Size: 43.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.8.17

File hashes

Hashes for cudo_compute_sdk-0.0.1.tar.gz
Algorithm Hash digest
SHA256 474f6ee3a79288a022a43ef6bba72bb6d06254903b4fa6cbfd470f285ad0b18d
MD5 6c845e364ddef2299c5022f748955839
BLAKE2b-256 c9f9756e7148e2caa7e67d1aedb613c77bf2277d0a3776aa59cd642b347de57e

See more details on using hashes here.

File details

Details for the file cudo_compute_sdk-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for cudo_compute_sdk-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e41c9c9f33fcd902b95ccca4c369a836dfd0b76fedcff59e3347f513326ff5cc
MD5 451ba256b9626a3cd7b11adcbeca7a9b
BLAKE2b-256 c7c1680152351f547242947464474682d2ec9ac2e92d81602e1847cab07e5e11

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page