The Python micro framework for building gPRC application.
Project description
gRPCAlchemy
The Python micro framework for building gPRC application.
Free software: MIT license
Documentation: https://grpcalchemy.readthedocs.io.
Installation
Disclaimer: Still at an early stage of development. Rapidly evolving APIs.
$ pipenv install grpcalchemy
✨🍰✨
Only Python 3.6+ is supported.
Example
Server
from grpcalchemy.blueprint import Blueprint, Context
from grpcalchemy.orm import Message, StringField
from grpcalchemy.server import Server
class HelloMessage(Message):
__filename__ = 'hello'
text = StringField()
hello = Blueprint("hello")
@hello.register
def test(request: HelloMessage, context: Context) -> HelloMessage:
return HelloMessage(text=f"Hello {request.text}")
if __name__ == '__main__':
app = Server()
app.register(hello_world)
app.run()
Client
from grpcalchemy.blueprint import Blueprint, Context
from grpcalchemy.client import Client
from grpcalchemy.orm import Message, StringField
class HelloMessage(Message):
__filename__ = 'hello'
text = StringField()
hello = Blueprint("hello")
@hello.register
def test(request: HelloMessage, context: Context) -> HelloMessage:
return HelloMessage(text=f"Hello {request.text}")
if __name__ == '__main__':
with Client("localhost:50051") as client:
client.register(hello)
response: HelloMessage = client.hello(
rpc=test, message=HelloMessage(text="world"))
print(response.text) # Hello world
Features
gPRC Service Support
gRPC Client Support
- gRPC Message Support
Scalar Value Types
Message Types
Repeated Field
Maps
Middleware And Listeners
TODO
All Types Support
Credits
This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.
History
0.1.7 (2019)
Support Inheritance Message
0.1.6 (2019-01-21)
Various bug-fixes
Improve tests
Change Client API
Add PreProcess And PostProcess
Import Config Object
Add Event Listener
Change Field Object Into Descriptor
0.1.5 (2018-12-14)
Various bug-fixes
Improve tests
Add client
0.1.4 (2018-12-11)
First release on PyPI.
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
Built Distribution
Hashes for grpcalchemy-0.1.6.post0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bde15a26da2965e839ccb8816fb1a2a1c10edba601305fd96864503742ea856d |
|
MD5 | 390062d061fe9381e369ddf42b1a4967 |
|
BLAKE2b-256 | 061654d280a12858f9e096efee83b2726e45a27c334fcded2d2b372981149190 |