Skip to main content

The Python micro framework for building gPRC application.

Project description

gRPCAlchemy

https://img.shields.io/pypi/v/grpcalchemy.svg https://github.com/GuangTianLi/grpcalchemy/workflows/test/badge.svg Documentation Status https://img.shields.io/pypi/pyversions/grpcalchemy.svg https://codecov.io/gh/GuangTianLi/grpcalchemy/branch/master/graph/badge.svg

The Python micro framework for building gPRC application based on official gRPC project.

Installation

$ pipenv install grpcalchemy
✨🍰✨

Only Python 3.6+ is supported.

Example

Server

from grpcalchemy.orm import Message, StringField
from grpcalchemy import Server, Context, grpcmethod

class HelloMessage(Message):
    text: str

class HelloService(Server):
    @grpcmethod
    def Hello(self, request: HelloMessage, context: Context) -> HelloMessage:
        return HelloMessage(text=f'Hello {request.text}')

if __name__ == '__main__':
    HelloService.run()

Then Using gRPC channel to connect the server:

from grpc import insecure_channel

from protos.helloservice_pb2_grpc import HelloServiceStub
from protos.hellomessage_pb2 import HelloMessage

with insecure_channel("localhost:50051") as channel:
    response = HelloServiceStub(channel).Hello(
        HelloMessage(text="world")
    )

Features

  • gPRC Service Support

  • gRPC Message Support
    • Scalar Value Types

    • Message Types

    • Repeated Field

    • Maps

  • Define Message With Type Hint

  • Middleware

  • App Context Manger

  • Error Handler Support

  • Streaming Method Support

  • gRPC-Health Checking and Reflection Support (Alpha)

  • Multiple Processor Support

TODO

  • Test Client Support

  • Async Server Support

History

0.7.*(2021-03-20)

  • Improve initialize function of message

  • Remove default feature in message

  • Refactor composite message Type

  • Support gRPC with xDS

  • Add PROTO_AUTO_GENERATED setting to make runtime proto generation optional

0.6.*(2020-10-27)

  • fix [#36] compatibility in windows

  • fix [#34] compatibility in windows

  • gRPC-Health Checking and Reflection Support (Alpha)

  • Multiple Processor Support

0.5.0(2020-04-27)

  • Support Streaming Method

  • Deprecate request parameter in app context and handle exception

0.4.0(2019-09-24)

  • Support related directory path to generate protocol buffer files

  • Enable use type hint to define message

  • Add error handle to handle Exception

  • Add get_blueprints to get blueprints need to register

0.3.0(2019-08-19)

https://github.com/GuangTianLi/grpcalchemy/projects/1

0.2.7-10(2019-04-16)

  • Support SSL

  • Improve Implement of Server with grpc.server

  • Support YAML file in Config Module

  • Improve Config Module

  • Add context in current rpc

0.2.5-6(2019-03-06)

  • Implement Rpc Context

  • Improve Config Module

0.2.4(2019-03-01)

  • Implement Globals Variable

  • Implement APP Context

0.2.2-3 (2019-02-26)

  • Improve Config module

  • Improve rpc_call_wrap

0.2.1 (2019-02-14)

  • Implement Own gRPC Server

  • Implement gRPC Server Test Client

0.2.0 (2019-01-30)

  • Change gRPCAlchemy Server register to register_blueprint

  • Make gRPCAlchemy Server inherit from Blueprint

  • Support Json Format

  • 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

grpcalchemy-0.7.3.tar.gz (30.7 kB view details)

Uploaded Source

Built Distribution

grpcalchemy-0.7.3-py2.py3-none-any.whl (19.5 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file grpcalchemy-0.7.3.tar.gz.

File metadata

  • Download URL: grpcalchemy-0.7.3.tar.gz
  • Upload date:
  • Size: 30.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

File hashes

Hashes for grpcalchemy-0.7.3.tar.gz
Algorithm Hash digest
SHA256 d69fe4ecf097854e47c48e95b93e05c239547a202a1fc0b4e5f250dcbaa9db4c
MD5 5579543b277dec2d448af3ac408f1849
BLAKE2b-256 d0614fba12b53af106ac06ce6767724c50bef6e245783002aa80e2e7e99d6bae

See more details on using hashes here.

File details

Details for the file grpcalchemy-0.7.3-py2.py3-none-any.whl.

File metadata

  • Download URL: grpcalchemy-0.7.3-py2.py3-none-any.whl
  • Upload date:
  • Size: 19.5 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

File hashes

Hashes for grpcalchemy-0.7.3-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 253637f9909654728aee9522b65743cad6cb9e098e3f76c4733ce92b590f6230
MD5 5bcee02c424f5b83bca3adfd60d64565
BLAKE2b-256 7f9867e6312a5f4317118102125ac4d674e3b69813b45087dfb6f528df5553cc

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page