Skip to main content

DynagRPC Python abstraction library over gRPC and protobuf types.

Project description

DynagRPC

DynagRPC is a Python library to help writing/using gRPC and protobuf.

Simple server implementation

Say we have this protobuf definition for a simple addition RPC:

syntax = "proto3";
package tests.maths;

service Maths {
  rpc Add (AddRequest) returns (AddResponse) {}
}

message AddRequest {
  int32 first = 1;
  int32 second = 2;
}

message AddResponse {
  int32 result = 1;
}

Keeping just the proto (i.e., not compiled with protoc), we can use it with the following implementation in Python is:

from dynagrpc import GrpcServer

server = GrpcServer("tests", "Maths", "maths")

@server.rpc()
def add(first, second):
    return first + second

Which you can run, for example, with:

server.run(host="localhost", port="50051")

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

dynagrpc-0.1.0.tar.gz (16.1 kB view hashes)

Uploaded Source

Built Distribution

dynagrpc-0.1.0-py3-none-any.whl (15.8 kB view hashes)

Uploaded Python 3

Supported by

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