isolate-proto
isolate-proto provides the internal gRPC definitions for the Isolate Controller, a system designed for building, managing, and using isolated execution environments (e.g., virtualenv, conda, remote). As a protocol buffer library, it contains the generated Python code necessary for client-server communication within the 'Isolate Cloud' ecosystem. The current version is 0.30.9, and it appears to be under active development with recent updates.
Warnings
- gotcha This package is described as providing '(internal) gRPC definitions' on PyPI. This implies it might not be intended for general public consumption, potentially leading to a lack of comprehensive external documentation, breaking changes without public announcements, or limited support for external users.
- breaking Protobuf definitions are sensitive to changes. Renaming fields, changing field numbers, altering data types, or removing fields in `.proto` files can lead to backward incompatibility, causing deserialization failures or incorrect data interpretation in existing clients and services.
- gotcha The `isolate-proto` package lists `Python >=3.8` as a requirement, but the core `protobuf` runtime library (a necessary dependency for generated `.proto` code) officially requires `Python >=3.10` since version 7.x (e.g., protobuf 7.34.1). This discrepancy can lead to `ImportError` or runtime issues on Python 3.8 or 3.9 environments if a recent `protobuf` version is installed.
- gotcha To generate Python client/server code from `.proto` files, you need `grpcio-tools` and the `protoc` compiler. While `isolate-proto` provides pre-generated code, understanding and being able to regenerate these files is crucial for development, debugging, or integrating with custom `.proto` definitions.
Install
-
pip install isolate-proto
Imports
- IsolateServiceStub
from isolate_controller_pb2_grpc import IsolateServiceStub
- IsolateRequest
from isolate_controller_pb2 import IsolateRequest
Quickstart
import grpc
# Assuming you have generated isolate_controller_pb2.py and isolate_controller_pb2_grpc.py
# from the official .proto definitions. These files would typically be
# created by running 'python -m grpc_tools.protoc ...' against the .proto files.
# Placeholder imports - replace with actual generated module names and symbols
# based on the Isolate Controller's .proto files.
try:
from isolate_controller_pb2 import IsolateRequest, IsolateResponse
from isolate_controller_pb2_grpc import IsolateServiceStub
except ImportError:
print("Generated protobuf files (e.g., isolate_controller_pb2.py) not found.")
print("Please ensure you have generated them from the official .proto definitions using grpc_tools.protoc.")
exit(1)
def run_client():
# Replace 'localhost:50051' with the actual Isolate Controller gRPC server address
with grpc.insecure_channel('localhost:50051') as channel:
stub = IsolateServiceStub(channel)
try:
# Example request - replace with actual fields from IsolateRequest
request = IsolateRequest(name="example_task", payload=b"some_data")
response = stub.ExecuteTask(request)
print(f"Isolate Controller Response: {response.status}")
except grpc.RpcError as e:
print(f"Error communicating with Isolate Controller: {e.details}")
if __name__ == '__main__':
# This quickstart demonstrates client-side usage of the generated stubs.
# To run this, you'd also need a running gRPC server implementing the
# IsolateService as defined in the .proto files.
print("This is a placeholder quickstart. Actual usage requires generated")
print("protobuf files and a running Isolate Controller gRPC server.")
run_client()