Simple RPC with Protobuf Services
Go to file
Luke Murphy c85a0bfe85
continuous-integration/drone/push Build is failing Details
Add homage to RPC human
2020-08-09 02:57:20 +02:00
example Add generaton cli entrypoint 2020-08-09 02:52:58 +02:00
hrpc Add generaton cli entrypoint 2020-08-09 02:52:58 +02:00
.drone.yml Add drone config 2020-08-09 01:34:56 +02:00
.gitignore Init hrpc 2020-08-09 01:33:07 +02:00
CHANGELOG.md Init hrpc 2020-08-09 01:33:07 +02:00
LICENSE Init hrpc 2020-08-09 01:33:07 +02:00
README.md Add homage to RPC human 2020-08-09 02:57:20 +02:00
poetry.lock Add protoc and purerpc plugin 2020-08-09 01:39:44 +02:00
pyproject.toml Add entrypoint 2020-08-09 02:52:46 +02:00

README.md

hrpc

Build Status

Simple RPC with Protobuf Services

Install

$ pip install hrpc

Example

TLDR; See the example directory

Define an RPC service in a schema.proto.

syntax = "proto2";

message EchoMsg {
  required string value = 1;
}

service Example {
  rpc Echo (EchoMsg) returns (EchoMsg) {}
}

Then generate the services and stubs with hrpc.

$ pip install hrpc
$ hrpc schema.proto

This creates schema_gprc.py (services) and schema_pb2.py (stubs) files.

You can then write a async-ready server and client like so.

# server.py
# client.py

And run them in separate terminals to see the output.

$ python server.py # terminal 1
$ python client.py # terminal 2

Go forth and Remote Procedure Call.

The person who invented the term RPC