Rename to avoid name clash
This commit is contained in:
1
hyper_rpc/__init__.py
Normal file
1
hyper_rpc/__init__.py
Normal file
@ -0,0 +1 @@
|
||||
"""hrpc module."""
|
24
hyper_rpc/hrpc.py
Normal file
24
hyper_rpc/hrpc.py
Normal file
@ -0,0 +1,24 @@
|
||||
"""Simple RPC with Protobuf Services."""
|
||||
from argparse import ArgumentParser, FileType
|
||||
from shlex import split
|
||||
from subprocess import run
|
||||
|
||||
|
||||
def main():
|
||||
"""Command-line entrypoint."""
|
||||
parser = ArgumentParser(description="Generate hrpc service and stubs")
|
||||
parser.add_argument("protobuf", type=FileType("r"), help="protobuf file")
|
||||
args = parser.parse_args()
|
||||
generate(args)
|
||||
|
||||
|
||||
def generate(args):
|
||||
"""Generate services and stubs."""
|
||||
cmd = (
|
||||
"python -m grpc_tools.protoc "
|
||||
"--purerpc_out=. "
|
||||
"--python_out=. "
|
||||
"-I. "
|
||||
f"{args.protobuf.name}"
|
||||
)
|
||||
run(split(cmd))
|
Reference in New Issue
Block a user