Skip to content

capa-cloud/cloud-runtimes-python

Repository files navigation

Cloud Runtimes Python

Cloud Runtimes Python

Multi-Runtime Standard API for Python

Capa Β· Dapr Β· Layotto

Python Version License PyPI Version


πŸ“– Introduction

Cloud Runtimes Python provides the Multi-Runtime Standard API for Mecha architecture projects in Python.

This project defines a unified, vendor-neutral API specification that enables Python applications to use standardized interfaces for distributed system capabilities across different runtime implementations.

Supported Runtimes

Runtime Status Description
Capa βœ… Used Primary Mecha SDK implementation
Dapr πŸ“‹ Follow Sidecar runtime reference
Layotto πŸ“‹ Follow MOSN-based sidecar implementation

πŸ—οΈ Architecture

Cloud Runtimes Python Architecture

Module Structure

cloud-runtimes-python/
β”œβ”€β”€ cloud_runtimes/         # Core API package
β”‚   β”œβ”€β”€ rpc/                # RPC service invocation
β”‚   β”œβ”€β”€ configuration/      # Configuration management
β”‚   β”œβ”€β”€ pubsub/             # Pub/Sub messaging
β”‚   β”œβ”€β”€ state/              # State management
β”‚   β”œβ”€β”€ secret/             # Secret management
β”‚   └── telemetry/          # Telemetry (logs, metrics, traces)
β”œβ”€β”€ tests/                  # Test suite
β”œβ”€β”€ docs/                   # Documentation
β”œβ”€β”€ setup.py                # Package setup
β”œβ”€β”€ pyproject.toml          # Modern Python packaging
└── requirements.txt        # Dependencies

Key Design Principles:

  • API-First: Clean interfaces separate specification from implementation
  • Runtime Agnostic: Works with Capa SDK, Dapr, Layotto, and future runtimes
  • Pythonic: Follows Python best practices (PEP 8, type hints, async/await)
  • Vendor Neutral: No lock-in to specific cloud providers

✨ Features

Cloud Runtimes Python Features

Stable Features

Feature Interface Description Status
πŸ”— Service Invocation InvocationRuntimes Service-to-service communication βœ… Stable
βš™οΈ Configuration ConfigurationRuntimes Dynamic configuration management βœ… Stable
πŸ“¨ Pub/Sub PubSubRuntimes Publish/Subscribe messaging βœ… Stable
πŸ’Ύ State Management StateRuntimes Key-value state storage βœ… Stable
πŸ” Secret Management SecretsRuntimes Secure secret retrieval βœ… Stable
πŸ“Š Telemetry TelemetryRuntimes Logs, metrics, and traces βœ… Stable
πŸ“ File System FileRuntimes File storage operations βœ… Stable
πŸ”’ Distributed Lock LockRuntimes Distributed locking βœ… Stable

Alpha Features

Feature Interface Description Status
πŸ—„οΈ Database DatabaseRuntimes SQL database operations πŸ”¬ Alpha

🎯 Motivation

Cloud Runtimes Python was created to bring standardized, portable APIs to the Python ecosystem:


πŸš€ Getting Started

Installation

From PyPI

pip install cloud-runtimes-python==0.0.1

In a Virtual Environment (Recommended)

python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
pip install cloud-runtimes-python==0.0.1

Quick Example

from cloud_runtimes.core import InvocationRuntimes

async def invoke(runtime: InvocationRuntimes) -> bytes:
    return await runtime.invoke_method(
        app_id="service-name",
        method_name="my-method",
        data=b'{"key":"value"}',
    )

Runtime Implementations

This package defines abstract interfaces. Applications must provide an adapter for their chosen runtime and inject those implementations into their own client or service layer.


πŸ“š API Interfaces

Service Invocation

InvocationRuntimes defines asynchronous method invocation and registration, plus synchronous invocation helpers.

Configuration

ConfigurationRuntimes defines get, save, delete, subscribe, and unsubscribe operations for configuration stores.

State Management

StateRuntimes defines single and bulk state operations, optimistic-concurrency options, and transactional operations.


🌐 Ecosystem

Cloud Runtimes Python is part of the broader Capa Cloud ecosystem:

Project Language Description
cloud-runtimes-jvm Java JVM API specification
cloud-runtimes-golang Go Go API specification

🀝 Contributing

We welcome contributions from the Python community!

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Development Setup

# Clone the repository
git clone https://github.com/capa-cloud/cloud-runtimes-python.git
cd cloud-runtimes-python

# Create virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

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

# Run tests
pytest tests/

# Run code quality checks
black .
isort .
flake8

Code Style

We use industry-standard tools for code quality:


πŸ“œ License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.


Building portable, vendor-neutral cloud APIs for Python

Capa Cloud Β· Documentation

About

Cloud Runtimes Specification for the Python3.

Resources

License

Stars

1 star

Watchers

1 watching

Forks

Packages

 
 
 

Contributors

Languages