All Projects → RussellLuo → grpc-pytools

RussellLuo / grpc-pytools

Licence: other
Some useful Python's gRPC tools.

Programming Languages

python
139335 projects - #7 most used programming language
Makefile
30231 projects

Labels

grpc-pytools

Some useful Python's gRPC tools.

Prerequisites

Install gRPC tools:

$ pip install grpcio-tools

See gRPC Python Quickstart for more details.

Installation

Install grpc-pytools:

$ pip install grpc-pytools

Usage

Plugins

AST-like JSON

Generate an AST-like JSON file from the .proto file:

$ python -m grpc_tools.protoc -I. --pytools-ast_out=. xx.proto

Tools

Pythonic services

Generate more Pythonic services for all gRPC services defined in the xx_pb2.py file (generated by grpcio-tools):

$ python -m grpc_pytools.pythonic --proto-ast-file=/path/to/xx_ast.json --pb2-module-name=python.path.to.xx_pb2

Marshmallow schemas

Generate Marshmallow schemas for all gRPC messages defined in the xx_pb2.py file:

$ python -m grpc_pytools.marshmallow --proto-ast-file=/path/to/xx_ast.json --pb2-module-name=python.path.to.xx_pb2

RESTArt APIs

Generate simple RESTArt APIs for all gRPC methods defined in the xx_pb2.py file:

$ python -m grpc_pytools.restart --proto-ast-file=/path/to/xx_ast.json --pb2-module-name=python.path.to.xx_pb2 --grpc-server=localhost:50051

Examples

See examples to find out how to generate a simple JSON proxy for gRPC services.

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].