Python Library to generate protobuffers code from python using type hints
Project description
Protomodel
Python Library to generate proto buffer code from python using type hints
Example
Generate a file hello.py and add the following code:
from protomodel import message, service, rpc
@message
class HelloRequest:
name: str
@message
class HelloReply:
message: str
@service
class Greeter:
@rpc
def say_hello(hello_request: HelloRequest) -> HelloReply:
...
Generate file
Run the following command to generate a proto buffer file
python -m protomodel generate --python_file=hello.py --proto_name=hello.proto
And then you will get the following result:
syntax = "proto3";
package app.proto;
message HelloRequest {
string name = 1;
}
message HelloReply {
string message = 1;
}
service Greeter {
rpc SayHello (HelloRequest) returns (HelloReply) {}
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
protomodel-0.0.6.tar.gz
(3.5 kB
view hashes)
Built Distribution
Close
Hashes for protomodel-0.0.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7c2a0bb6c29ea7ee0fecdc2e758872d9f2f445de778f433c0a18e3a247d93fb8 |
|
MD5 | 041206d979caa0f6a9d6aec4366908ad |
|
BLAKE2b-256 | 65e801907a79a12282019f9913a2fc0cae5de19e5e7f17375ddc165694330725 |