Metadata-Version: 2.1
Name: python-fast-grpc
Version: 0.1.2
Summary: fast to code grpc in python
Author: taogeYT
Author-email: li_yatao@outlook.com
Requires-Python: >=3.7,<4.0
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Requires-Dist: blinker (>=1.6.1,<2.0.0)
Requires-Dist: grpcio (>=1.53.0,<2.0.0)
Requires-Dist: grpcio-tools (>=1.53.0,<2.0.0)
Requires-Dist: logzero (>=1.7.0,<2.0.0)
Requires-Dist: protobuf (>=4.22.0,<5.0.0)
Requires-Dist: pydantic (>=1.10.0,<2.0.0)
Description-Content-Type: text/markdown

# fast-grpc
fast to code grpc in Python 3.7+

# Installation
Require Python 3.7+
```shell
pip install python-fast-grpc
```

# Quick start
1. Run a gRPC application
```python
from fast_grpc import BaseSchema, FastGRPC

rpc = FastGRPC("Greeter")

class HelloRequest(BaseSchema):
    name: str

class HelloReply(BaseSchema):
    message: str

@rpc.add_method("SayHello", request_model=HelloRequest, response_model=HelloReply)
async def say_hello(request: HelloRequest) -> HelloReply:
    return HelloReply(message=f"Hello {request.name}")

# this step will generate .proto file and python gRPC code, then start a grpc server
rpc.run()
```
2. run client invoke
```python
import grpc
import greeter_pb2 as pb2
import greeter_pb2_grpc as pb2_grpc

channel = grpc.insecure_channel("127.0.0.1:50051")
stub = pb2_grpc.GreeterStub(channel)
response = stub.SayHello(pb2.HelloRequest(name="fastGRPC"))
print("Greeter client received: ", response)
```

